torch_sub: Sub

Description Usage Arguments sub(input, other, *, alpha=1, out=None) -> Tensor Examples

View source: R/gen-namespace.R

Description

Sub

Usage

1
torch_sub(self, other, alpha = 1L)

Arguments

self

(Tensor) the input tensor.

other

(Tensor or Scalar) the tensor or scalar to subtract from input

alpha

the scalar multiplier for other

sub(input, other, *, alpha=1, out=None) -> Tensor

Subtracts other, scaled by alpha, from input.

\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.

Examples

1
2
3
4
5
6
if (torch_is_installed()) {

a <- torch_tensor(c(1, 2))
b <- torch_tensor(c(0, 1))
torch_sub(a, b, alpha=2)
}

torch documentation built on Oct. 7, 2021, 9:22 a.m.