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,.,.) =
#> -0.7096 -2.4952 -0.5448 -1.6013 -0.9051
#> -2.7673 1.0499 -1.9971 -0.6267 0.0458
#> -3.0538 0.0669 -0.9028 0.6094 0.5897
#>
#> (2,.,.) =
#> -5.6211 -3.3761 -0.1902 -3.6141 -1.8894
#> 3.6859 0.2111 -3.5261 2.8575 0.2995
#> -1.4334 2.3205 -0.7313 3.4281 1.7564
#>
#> (3,.,.) =
#> 2.8008 -4.4372 -1.0890 2.2385 -2.8341
#> 2.7623 -3.3589 -0.8144 0.3101 1.6893
#> 0.1959 -0.2360 -1.9945 1.0803 -1.5615
#>
#> (4,.,.) =
#> 2.6185 3.0292 0.7357 -0.5216 3.0430
#> 4.1578 6.5513 0.8269 -1.0677 -1.3759
#> -0.5773 -3.3140 0.8970 0.1639 0.6223
#>
#> (5,.,.) =
#> 0.2924 2.5694 1.3157 -2.0076 3.0194
#> 1.8499 -2.1976 2.1450 -1.0396 -0.9372
#> 1.1715 5.0453 3.7745 2.8443 -1.5944
#>
#> (6,.,.) =
#> 3.8417 -1.9900 0.6235 -0.6033 0.6244
#> 1.4074 -0.6490 -1.0878 -1.2655 2.3180
#> -1.3387 -7.5901 -8.9160 -4.7847 -0.4269
#>
#> ... [the output was truncated (use n=-1 to disable)]
#> [ CPUFloatType{10,3,5} ]