ConcatOperation
Applicable Products
Hardware Model |
Supported |
|---|---|
Atlas 350 accelerator cards |
√ |
√ |
|
√ |
|
√ |
|
√ |
|
√ |
Description
Combines two input tensors into an output tensor at a specified dimension.

Operator Context

Definition
1 2 3 4 | struct ConcatParam { int concatDim = 0; uint8_t rsv[12] = {0}; }; |
Parameters
Member |
Type |
Default Value |
Description |
|---|---|---|---|
concatDim |
int |
0 |
Dimension index for concat. Assume that the dimension index for concatenation is k and the number of dimensions of x is dimNum:
|
rsv[12] |
uint8_t |
{0} |
Reserved |
Input
Parameter |
Dimension |
Data Type |
Format |
Description |
|---|---|---|---|---|
x |
[x_dim_0, x_dim_1, ... , x_dim_n] |
float16/bf16 |
ND |
Tensor to be concatenated. |
y |
[y_dim_0, y_dim_1, ... , y_dim_n] |
float16/bf16 |
ND |
Tensor to be concatenated. The dimensions except y_dim_k are the same as those of x. |
Output
Parameter |
Dimension |
Data Type |
Format |
Description |
|---|---|---|---|---|
output |
[dim_0, dim_1, ..., dim_n] |
float16/bf16 |
ND |
Concatenated tensor. |
Constraints
- Restrictions on the parameters:
- dimNum: number of dimensions of the concatenated tensor.
- -dimNum ≤ concatDim ≤ dimNum - 1.
- Input constraints
- The inputs x and y have the same dimensions.
- The dimension size of the inputs x and y must be the same except the concatDim dimension.
API Calling Example
- Input
x shape = [3, 2, 3]: [[[1.0, 1.0, 1.0], [1.0, 1.0, 1.0]], [[1.0, 1.0, 1.0], [1.0, 1.0, 1.0]], [[1.0, 1.0, 1.0], [1.0, 1.0, 1.0]]] y shape = [3, 1, 3]: [[[2.0, 2.0, 2.0]], [[2.0, 2.0, 2.0]], [[2.0, 2.0, 2.0]]] param.concatDim = 1 (or -2)
- Output
output shape = [3, 3, 3] [[[1.0, 1.0, 1.0], [1.0, 1.0, 1.0], [2.0, 2.0, 2.0]], [[1.0, 1.0, 1.0], [1.0, 1.0, 1.0], [2.0, 2.0, 2.0]], [[1.0, 1.0, 1.0], [1.0, 1.0, 1.0], [2.0, 2.0, 2.0]]]