PyTorch torch.negative function
PyTorch torch reference manual
torch.negative is a function in PyTorch used to take the element-wise negative. Similar to torch.neg in functionality.
Function definition
torch.negative(input, out=None)
Usage examples
Example
import
torch
Element-wise negation
x
=
torch.
tensor
(
[
1.0
,
2.0
,
3.0
]
)
result
=
torch.
negative
(
x
)
(
result
)