评价此页

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