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

torch_baddbmm

Baddbmm


Description

Baddbmm

Usage

torch_baddbmm(self, batch1, batch2, beta = 1L, alpha = 1L)

Arguments

self

(Tensor) the tensor to be added

batch1

(Tensor) the first batch of matrices to be multiplied

batch2

(Tensor) the second batch of matrices to be multiplied

beta

(Number, optional) multiplier for input (β)

alpha

(Number, optional) multiplier for \mbox{batch1} \mathbin{@} \mbox{batch2} (α)

baddbmm(input, batch1, batch2, *, beta=1, alpha=1, out=NULL) -> Tensor

Performs a batch matrix-matrix product of matrices in batch1 and batch2. input is added to the final result.

batch1 and batch2 must be 3-D tensors each containing the same number of matrices.

If batch1 is a (b \times n \times m) tensor, batch2 is a (b \times m \times p) tensor, then input must be broadcastable with a (b \times n \times p) tensor and out will be a (b \times n \times p) tensor. Both alpha and beta mean the same as the scaling factors used in torch_addbmm.

\mbox{out}_i = β\ \mbox{input}_i + α\ (\mbox{batch1}_i \mathbin{@} \mbox{batch2}_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(10, 3, 5))
batch1 = torch_randn(c(10, 3, 4))
batch2 = torch_randn(c(10, 4, 5))
torch_baddbmm(M, batch1, batch2)
}

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.