評價此頁

torch.positive#

torch.positive(input) Tensor#

返回 input。如果 input 是布林張量,則會丟擲執行時錯誤。

引數

input (Tensor) – 輸入張量。

示例

>>> t = torch.randn(5)
>>> t
tensor([ 0.0090, -0.2262, -0.0682, -0.2866,  0.3940])
>>> torch.positive(t)
tensor([ 0.0090, -0.2262, -0.0682, -0.2866,  0.3940])