mindspore.ops.Concat
- class mindspore.ops.Concat(axis=0)[source]
Connect tensor in the specified axis.
Refer to
mindspore.ops.concat()
for more details.- Parameters
axis (int, optional) – The specified axis. Default: 0.
- Inputs:
input_x (Union[tuple, list]) - A tuple or a list of input tensors. Suppose there are two tensors in this tuple or list, namely x1 and x2. To perform Concat in the axis 0 direction, except for the 0th axis, all other axes should be equal, that is, \(x1.shape[1] == x2.shape[1], x1.shape[2] == x2.shape[2], ..., x1.shape[R] == x2.shape[R]\), where the \(R\) indicates the last axis.
- Outputs:
Tensor, the shape is \((x_1, x_2, ..., \sum_{i=1}^Nx_{mi}, ..., x_R)\). The data type is the same with input_x.
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> input_x1 = Tensor(np.array([[0, 1], [2, 1]]).astype(np.float32)) >>> input_x2 = Tensor(np.array([[0, 1], [2, 1]]).astype(np.float32)) >>> op = ops.Concat() >>> output = op((input_x1, input_x2)) >>> print(output) [[0. 1.] [2. 1.] [0. 1.] [2. 1.]] >>> op = ops.Concat(1) >>> output = op((input_x1, input_x2)) >>> print(output) [[0. 1. 0. 1.] [2. 1. 2. 1.]]