Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

torch_addr

Addr


Description

Addr

Usage

torch_addr(self, vec1, vec2, beta = 1L, alpha = 1L)

Arguments

self

(Tensor) matrix to be added

vec1

(Tensor) the first vector of the outer product

vec2

(Tensor) the second vector of the outer product

beta

(Number, optional) multiplier for input (β)

alpha

(Number, optional) multiplier for \mbox{vec1} \otimes \mbox{vec2} (α)

addr(input, vec1, vec2, *, beta=1, alpha=1, out=NULL) -> Tensor

Performs the outer-product of vectors vec1 and vec2 and adds it to the matrix input.

Optional values beta and alpha are scaling factors on the outer product between vec1 and vec2 and the added matrix input respectively.

\mbox{out} = β\ \mbox{input} + α\ (\mbox{vec1} \otimes \mbox{vec2})

If vec1 is a vector of size n and vec2 is a vector of size m, then input must be broadcastable with a matrix of size (n \times m) and out will be a matrix of size (n \times m).

For inputs of type FloatTensor or DoubleTensor, arguments beta and alpha must be real numbers, otherwise they should be integers

Examples

if (torch_is_installed()) {

vec1 = torch_arange(1, 3)
vec2 = torch_arange(1, 2)
M = torch_zeros(c(3, 2))
torch_addr(M, vec1, vec2)
}

torch

Tensors and Neural Networks with 'GPU' Acceleration

v0.3.0
MIT + file LICENSE
Authors
Daniel Falbel [aut, cre, cph], Javier Luraschi [aut], Dmitriy Selivanov [ctb], Athos Damiani [ctb], Christophe Regouby [ctb], Krzysztof Joachimiak [ctb], RStudio [cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.