捷徑

torch.log

torch.log(input, *, out=None) Tensor

傳回一個新的 tensor,其元素為 input 的自然對數。

yi=loge(xi)y_{i} = \log_{e} (x_{i})
參數

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])

文件

存取 PyTorch 的完整開發者文件

檢視文件

教學

取得針對初學者和進階開發者的深入教學

檢視教學

資源

尋找開發資源並獲得問題解答

檢視資源