Baddbmm
Source:R/gen-namespace-docs.R
, R/gen-namespace-examples.R
, R/gen-namespace.R
torch_baddbmm.Rd
Baddbmm
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 batch2
is a
input
must be
broadcastable with a
out
will be a
alpha
and beta
mean the
same as the scaling factors used in torch_addbmm
.
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_tensor
#> (1,.,.) =
#> -1.1001 0.7552 -3.3802 0.9889 -0.5060
#> 3.9004 0.2481 -1.5327 -2.1009 3.2656
#> -1.2878 0.0020 1.4947 1.2510 -2.6341
#>
#> (2,.,.) =
#> 1.4413 -4.3586 -0.9760 -0.4607 -2.5707
#> 0.4550 -2.4910 0.1114 -1.2042 -4.2250
#> -0.5545 0.1002 0.1043 0.3360 1.6588
#>
#> (3,.,.) =
#> 1.1137 0.0375 -2.6468 2.9447 3.3930
#> -0.3208 0.8786 -0.6220 1.8655 -0.5127
#> -5.8664 -1.3465 -0.4836 -1.1213 2.0625
#>
#> (4,.,.) =
#> -1.0890 4.2098 -4.6076 0.2430 -3.8767
#> 2.3953 -3.3443 3.5276 0.2865 -0.6888
#> -0.6316 2.4203 -0.5888 0.7332 -1.1303
#>
#> (5,.,.) =
#> -0.0388 -1.6542 -0.7763 -0.5889 -0.2215
#> 2.3043 0.1464 3.2428 4.3219 1.0653
#> 0.6359 -0.4460 2.4775 2.6263 2.3618
#>
#> (6,.,.) =
#> -0.7956 0.5339 -0.8440 -1.7119 -0.5565
#> -2.7606 1.6186 0.6894 -0.7590 -2.1902
#> 0.1447 -0.1125 -1.2370 -0.1133 -0.3476
#>
#> ... [the output was truncated (use n=-1 to disable)]
#> [ CPUFloatType{10,3,5} ]