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

torch_addmm

Addmm


Description

Addmm

Usage

torch_addmm(self, mat1, mat2, beta = 1L, alpha = 1L)

Arguments

self

(Tensor) matrix to be added

mat1

(Tensor) the first matrix to be multiplied

mat2

(Tensor) the second matrix to be multiplied

beta

(Number, optional) multiplier for input (β)

alpha

(Number, optional) multiplier for mat1 @ mat2 (α)

addmm(input, mat1, mat2, *, beta=1, alpha=1, out=NULL) -> Tensor

Performs a matrix multiplication of the matrices mat1 and mat2. The matrix input is added to the final result.

If mat1 is a (n \times m) tensor, mat2 is a (m \times p) tensor, then input must be broadcastable with a (n \times p) tensor and out will be a (n \times p) tensor.

alpha and beta are scaling factors on matrix-vector product between mat1 and mat2 and the added matrix input respectively.

\mbox{out} = β\ \mbox{input} + α\ (\mbox{mat1}_i \mathbin{@} \mbox{mat2}_i)

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()) {

M = torch_randn(c(2, 3))
mat1 = torch_randn(c(2, 3))
mat2 = torch_randn(c(3, 3))
torch_addmm(M, mat1, mat2)
}

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.