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.8747 2.7116 -1.9605 -2.5448 -0.7616
#> 0.5820 -1.9892 1.7117 -0.2892 0.4162
#> -3.0926 0.4680 0.1686 1.7324 -1.0170
#>
#> (2,.,.) =
#> 1.9619 1.3288 0.9719 1.0108 -4.4842
#> -2.5403 0.1741 0.3527 0.3679 -1.2192
#> 0.9423 -0.1049 -1.8414 0.1004 4.1637
#>
#> (3,.,.) =
#> 1.3505 0.4892 4.1143 2.3817 -0.9033
#> -0.2163 0.0489 -2.4095 -3.3519 0.0691
#> 2.2633 3.3438 0.7845 1.4967 1.4554
#>
#> (4,.,.) =
#> 3.8104 -1.2033 1.3291 -0.4609 -0.7298
#> 3.1195 -0.1612 1.3787 1.7386 -1.7486
#> -0.9602 2.3897 0.6790 -1.8008 2.2341
#>
#> (5,.,.) =
#> -1.8901 1.0118 0.8525 -4.1708 3.7186
#> 2.2699 0.1018 0.8561 2.0228 -0.2011
#> -2.1236 2.2618 0.8220 0.8760 0.8450
#>
#> (6,.,.) =
#> 1.5310 -0.1770 0.4190 1.5319 -0.5963
#> 1.8078 2.9346 -2.1238 0.1933 4.7776
#> 1.0082 -2.4974 -2.4940 0.0338 -2.2650
#>
#> ... [the output was truncated (use n=-1 to disable)]
#> [ CPUFloatType{10,3,5} ]