Dstack
Source:R/gen-namespace-docs.R
, R/gen-namespace-examples.R
, R/gen-namespace.R
torch_dstack.Rd
Dstack
dstack(tensors, *, out=None) -> Tensor
Stack tensors in sequence depthwise (along third axis).
This is equivalent to concatenation along the third axis after 1-D and 2-D
tensors have been reshaped by torch_atleast_3d()
.
Examples
if (torch_is_installed()) {
a <- torch_tensor(c(1, 2, 3))
b <- torch_tensor(c(4, 5, 6))
torch_dstack(list(a,b))
a <- torch_tensor(rbind(1,2,3))
b <- torch_tensor(rbind(4,5,6))
torch_dstack(list(a,b))
}
#> torch_tensor
#> (1,.,.) =
#> 1 4
#>
#> (2,.,.) =
#> 2 5
#>
#> (3,.,.) =
#> 3 6
#> [ CPUFloatType{3,1,2} ]