powered by
Sub
torch_sub(self, other, alpha = 1L)
(Tensor) the input tensor.
(Tensor or Scalar) the tensor or scalar to subtract from input
input
the scalar multiplier for other
Subtracts other, scaled by alpha, from input.
other
alpha
$$ \mbox{{out}}_i = \mbox{{input}}_i - \mbox{{alpha}} \times \mbox{{other}}_i $$
Supports broadcasting to a common shape , type promotion , and integer, float, and complex inputs.
if (torch_is_installed()) { a <- torch_tensor(c(1, 2)) b <- torch_tensor(c(0, 1)) torch_sub(a, b, alpha=2) }
Run the code above in your browser using DataLab