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,.,.) =
#> 2.5668 -0.4237 -2.9404 1.3825 -1.3862
#> -0.6745 1.4488 1.6203 -1.6715 0.3611
#> -3.2829 -3.6264 -1.0860 -0.0391 -1.4816
#>
#> (2,.,.) =
#> 0.9901 -1.3908 0.0594 -0.0992 -3.2152
#> 1.6730 -1.8321 -0.7380 2.6288 -4.1835
#> -1.0785 -3.8915 0.1029 0.1313 -4.7576
#>
#> (3,.,.) =
#> 1.4986 1.2973 1.7373 -1.9960 3.4302
#> -4.2607 -1.2940 0.6256 2.7559 7.3600
#> -2.4782 0.4995 -1.8852 1.9486 5.8216
#>
#> (4,.,.) =
#> -2.7854 -1.9376 0.6116 -0.5304 -2.7533
#> 7.3231 2.4280 0.7276 2.5102 2.7631
#> -1.4774 -0.9340 0.5800 0.3354 -2.6695
#>
#> (5,.,.) =
#> -3.1803 1.0826 -1.9716 -0.6409 0.4772
#> 1.5822 0.5086 0.8684 0.4020 0.1475
#> 2.3245 0.8159 -0.1406 -0.9883 -1.2855
#>
#> (6,.,.) =
#> 0.5705 1.1246 0.2826 0.3696 0.0717
#> 0.7779 1.0982 2.0234 -0.6402 -4.6686
#> 2.7589 -0.8088 -0.5637 2.0045 -0.7080
#>
#> ... [the output was truncated (use n=-1 to disable)]
#> [ CPUFloatType{10,3,5} ]