torch.log¶ torch.log(input, *, out=None) → Tensor¶ 傳回一個新的 tensor,其元素為 input 的自然對數。 yi=loge(xi)y_{i} = \log_{e} (x_{i}) yi=loge(xi) 參數 input (Tensor) – 輸入 tensor。 關鍵字參數 out (Tensor, optional) – 輸出 tensor。(可選) 範例 >>> a = torch.rand(5) * 5 >>> a tensor([4.7767, 4.3234, 1.2156, 0.2411, 4.5739]) >>> torch.log(a) tensor([ 1.5637, 1.4640, 0.1952, -1.4226, 1.5204])