concatenate¶
- tripy.concatenate(tensors: Sequence[Tensor], dim: int) Tensor [source]¶
Returns a copy of the input tensor on the target device.
- Parameters:
tensors (Sequence[Tensor]) – [dtype=T1] Sequence of tensors of the same type and having the same shape except in the concatenated dimension.
dim (int) – the dimension over which the tensors are concatenated.
- Returns:
[dtype=T1] Concatenated tensor with shape along dim axis equal to sum of dimensions at dim axis for all inputs.
- Return type:
Example
1a = tp.iota((1, 2), dtype=tp.float32) 2b = tp.iota((2, 2), dtype=tp.float32) 3 4output = tp.concatenate([a, b], dim=0)
>>> a tensor( [[0.0000, 0.0000]], dtype=float32, loc=gpu:0, shape=(1, 2)) >>> b tensor( [[0.0000, 0.0000], [1.0000, 1.0000]], dtype=float32, loc=gpu:0, shape=(2, 2)) >>> output tensor( [[0.0000, 0.0000], [0.0000, 0.0000], [1.0000, 1.0000]], dtype=float32, loc=gpu:0, shape=(3, 2))