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

tch_baddbmm(x, batch1, batch2, beta = 1, alpha = 1)

Arguments

x

tensor object

batch1

the first batch of matrices to be multiplied

batch2

the second batch of matrices to be multiplied

beta

multiplier for x

alpha

multiplier for batch1 * batch2

Examples

x <- tensor(array(runif(45), dim = c(3, 3, 5))) batch1 <- tensor(array(runif(36), dim = c(3, 3, 4))) batch2 <- tensor(array(runif(60), dim = c(3, 4, 5))) tch_baddbmm(x, batch1, batch2)
#> tensor #> (1,.,.) = #> 1.8235 1.8044 1.1738 1.3777 1.0120 #> 1.9102 3.7442 1.8650 1.5697 2.0777 #> 1.1358 2.5151 2.1979 1.1476 1.4231 #> #> (2,.,.) = #> 0.9822 1.4914 1.4809 1.8327 1.6085 #> 1.6679 2.4760 1.7026 2.9018 2.5509 #> 1.4881 1.7932 0.9740 2.1827 2.3150 #> #> (3,.,.) = #> 1.7097 1.6868 1.9578 0.7815 1.2295 #> 1.1103 1.2823 1.1187 0.5574 1.0791 #> 1.3530 1.4687 1.8853 1.5337 1.3748 #> [ Variable[CPUFloatType]{3,3,5} ]