快捷鍵

torch.log1p

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

傳回一個新的 Tensor,其值為 (1 + input) 的自然對數。

yi=loge(xi+1)y_i = \log_{e} (x_i + 1)

注意

對於 input 的小數值,此函數比 torch.log() 更準確。

參數

input (Tensor) – 輸入的 tensor。

關鍵字參數

out (Tensor, optional) – 輸出的 tensor。

範例

>>> a = torch.randn(5)
>>> a
tensor([-1.0090, -0.9923,  1.0249, -0.5372,  0.2492])
>>> torch.log1p(a)
tensor([    nan, -4.8653,  0.7055, -0.7705,  0.2225])

文件

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources