torch_neg function

Neg

Neg

torch_neg(self)

Arguments

  • self: (Tensor) the input tensor.

neg(input, out=NULL) -> Tensor

Returns a new tensor with the negative of the elements of input.

\mboxout=1×\mboxinput \mbox{out} = -1 \times \mbox{input}

Examples

if (torch_is_installed()) { a = torch_randn(c(5)) a torch_neg(a) }
  • Maintainer: Daniel Falbel
  • License: MIT + file LICENSE
  • Last published: 2025-02-14