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])
本页目录