Cat
cat(tensors, dim=0, out=NULL) -> Tensor
Concatenates the given sequence of seq tensors in the given dimension.
All tensors must either have the same shape (except in the concatenating
dimension) or be empty.
torch_cat can be seen as an inverse operation for torch_split()
and torch_chunk.
torch_cat can be best understood via examples.
Examples
if (torch_is_installed()) {
x = torch_randn(c(2, 3))
x
torch_cat(list(x, x, x), 1)
torch_cat(list(x, x, x), 2)
}
#> torch_tensor
#> -0.3620 -1.4591 0.5103 -0.3620 -1.4591 0.5103 -0.3620 -1.4591 0.5103
#> -1.0821 0.3885 -0.7137 -1.0821 0.3885 -0.7137 -1.0821 0.3885 -0.7137
#> [ CPUFloatType{2,9} ]