mindspore.ops.Concat
- class mindspore.ops.Concat(*args, **kwargs)[source]
Connect tensor in the specified axis.
Connect input tensors along with the given axis.
The input data is a tuple of tensors. These tensors have the same rank R. Set the given axis as m, and
. Set the number of input tensors as N. For the -th tensor , it has the shape of . is the -th dimension of the -th tensor. Then, the shape of the output tensor is- Parameters
axis (int) – The specified axis. Default: 0.
- Inputs:
input_x (tuple, list) - A tuple or a list of input tensors. input_x, input_y should has same data type.
input_y (tuple, list) - A tuple or a list of input tensors. input_x, input_y should has same data type.
- Outputs:
- Tensor, the shape is
. The data type is the same with input_X and input_y.
- Tensor, the shape is
- Raises
TypeError – If axis is not an int.
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> input_x = Tensor(np.array([[0, 1], [2, 1]]).astype(np.float32)) >>> input_y = Tensor(np.array([[0, 1], [2, 1]]).astype(np.float32)) >>> op = ops.Concat() >>> output = op((input_x, input_y)) >>> print(output) [[0. 1.] [2. 1.] [0. 1.] [2. 1.]] >>> op = ops.Concat(1) >>> output = op((input_x, input_y)) >>> print(output) [[0. 1. 0. 1.] [2. 1. 2. 1.]]