PyTorch
torch / torch
torch.neg¶
-
torch.
neg
(input, *, out=None) → Tensor¶ Returns a new tensor with the negative of the elements of
input
.out=−1×input- Parameters
input (Tensor) – the input tensor.
- Keyword Arguments
out (Tensor, optional) – the output tensor.
Example:
>>> a = torch.randn(5) >>> a tensor([ 0.0090, -0.2262, -0.0682, -0.2866, 0.3940]) >>> torch.neg(a) tensor([-0.0090, 0.2262, 0.0682, 0.2866, -0.3940])
此页内容是否对您有帮助
感谢反馈!