Document feedback

Question document fragment

When a question document fragment contains a formula, it is displayed as a space.

Submission type
issue

It's a little complicated...

I'd like to ask someone.

Please select the submission type

Problem type
Specifications and Common Mistakes

- Specifications and Common Mistakes:

- Misspellings or punctuation mistakes,incorrect formulas, abnormal display.

- Incorrect links, empty cells, or wrong formats.

- Chinese characters in English context.

- Minor inconsistencies between the UI and descriptions.

- Low writing fluency that does not affect understanding.

- Incorrect version numbers, including software package names and version numbers on the UI.

Usability

- Usability:

- Incorrect or missing key steps.

- Missing main function descriptions, keyword explanation, necessary prerequisites, or precautions.

- Ambiguous descriptions, unclear reference, or contradictory context.

- Unclear logic, such as missing classifications, items, and steps.

Correctness

- Correctness:

- Technical principles, function descriptions, supported platforms, parameter types, or exceptions inconsistent with that of software implementation.

- Incorrect schematic or architecture diagrams.

- Incorrect commands or command parameters.

- Incorrect code.

- Commands inconsistent with the functions.

- Wrong screenshots.

- Sample code running error, or running results inconsistent with the expectation.

Risk Warnings

- Risk Warnings:

- Lack of risk warnings for operations that may damage the system or important data.

Content Compliance

- Content Compliance:

- Contents that may violate applicable laws and regulations or geo-cultural context-sensitive words and expressions.

- Copyright infringement.

Please select the type of question

Problem description

Describe the bug so that we can quickly locate the problem.

mindspore.ops.Concat

class mindspore.ops.Concat(axis=0)[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 0m<R. Set the number of input tensors as N. For the i-th tensor ti, it has the shape of (x1,x2,...,xmi,...,xR). xmi is the m-th dimension of the i-th tensor. Then, the shape of the output tensor is

(x1,x2,...,i=1Nxmi,...,xR)

Warning

The value range of “axis” is [-dims, dims - 1]. “dims” is the dimension length of “input_x”.

Parameters

axis (int) – The specified axis. Default: 0.

Inputs:
  • input_x (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 (x1,x2,...,i=1Nxmi,...,xR). The data type is the same with input_x.

Raises

TypeError – If axis is not an int.

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.]]