Addcmul
Source:R/gen-namespace-docs.R
, R/gen-namespace-examples.R
, R/gen-namespace.R
torch_addcmul.Rd
Addcmul
addcmul(input, tensor1, tensor2, *, value=1, out=NULL) -> Tensor
Performs the element-wise multiplication of tensor1
by tensor2
, multiply the result by the scalar value
and add it to input
.
tensor
, tensor1
, and tensor2
must be
broadcastable .
For inputs of type FloatTensor
or DoubleTensor
, value
must be
a real number, otherwise an integer.
Examples
if (torch_is_installed()) {
t = torch_randn(c(1, 3))
t1 = torch_randn(c(3, 1))
t2 = torch_randn(c(1, 3))
torch_addcmul(t, t1, t2, 0.1)
}
#> torch_tensor
#> -0.1819 -0.4754 0.6480
#> -0.0534 -0.3094 0.4265
#> -0.1282 -0.4060 0.5554
#> [ CPUFloatType{3,3} ]