mindspore.ops.ParallelConcat

class mindspore.ops.ParallelConcat(*args, **kwargs)[source]

Concats tensor in the first dimension.

Concats input tensors along with the first dimension.

The difference between Concat and ParallelConcat is that Concat requires all of the inputs be computed before the operation will begin but doesn’t require that the input shapes be known during graph construction. Parallel concat will copy pieces of the input into the output as they become available, in some situations this can provide a performance benefit.

Note

The input tensors are all required to have size 1 in the first dimension.

Inputs:
  • values (tuple, list) - A tuple or a list of input tensors. The data type and shape of these tensors must be the same. The data type is Number except float64.

Outputs:

Tensor, data type is the same as values.

Raises
  • ValueError – If length of shape of values is less than 1.

  • ValueError – The data type and shape of these tensors are not the same.

Supported Platforms:

Ascend

Examples

>>> data1 = Tensor(np.array([[0, 1]]).astype(np.int32))
>>> data2 = Tensor(np.array([[2, 1]]).astype(np.int32))
>>> op = ops.ParallelConcat()
>>> output = op((data1, data2))
>>> print(output)
[[0 1]
 [2 1]]