Concat#

Concat - 13#

Version

  • name: Concat (GitHub)

  • domain: main

  • since_version: 13

  • function: False

  • support_level: SupportType.COMMON

  • shape inference: True

This version of the operator has been available since version 13.

Summary

Concatenate a list of tensors into a single tensor. All input tensors must have the same shape, except for the dimension size of the axis to concatenate on.

Attributes

  • axis (required): Which axis to concat on. A negative value means counting dimensions from the back. Accepted range is [-r, r-1] where r = rank(inputs)..

Inputs

Between 1 and 2147483647 inputs.

  • inputs (variadic, heterogeneous) - T: List of tensors for concatenation

Outputs

  • concat_result (heterogeneous) - T: Concatenated tensor

Type Constraints

  • T in ( tensor(bfloat16), tensor(bool), tensor(complex128), tensor(complex64), tensor(double), tensor(float), tensor(float16), tensor(int16), tensor(int32), tensor(int64), tensor(int8), tensor(string), tensor(uint16), tensor(uint32), tensor(uint64), tensor(uint8) ): Constrain output types to any tensor type.

Examples

default

test_cases: Dict[str, Sequence[Any]] = {
    '1d': ([1, 2],
           [3, 4]),
    '2d': ([[1, 2], [3, 4]],
           [[5, 6], [7, 8]]),
    '3d': ([[[1, 2], [3, 4]], [[5, 6], [7, 8]]],
           [[[9, 10], [11, 12]], [[13, 14], [15, 16]]])
}

for test_case, values_ in test_cases.items():
    values = [np.asarray(v, dtype=np.float32) for v in values_]
    for i in range(len(values[0].shape)):
        in_args = ['value' + str(k) for k in range(len(values))]
        node = onnx.helper.make_node(
            'Concat',
            inputs=[s for s in in_args],
            outputs=['output'],
            axis=i
        )
        output = np.concatenate(values, i)
        expect(node, inputs=[v for v in values], outputs=[output],
               name='test_concat_' + test_case + '_axis_' + str(i))

    for i in range(-len(values[0].shape), 0):
        in_args = ['value' + str(k) for k in range(len(values))]
        node = onnx.helper.make_node(
            'Concat',
            inputs=[s for s in in_args],
            outputs=['output'],
            axis=i
        )
        output = np.concatenate(values, i)
        expect(node, inputs=[v for v in values], outputs=[output],
               name='test_concat_' + test_case + '_axis_negative_' + str(abs(i)))

Differences

00Concatenate a list of tensors into a single tensor. All input tensors must have the same shape, except for the dimension size of the axis to concatenate on.Concatenate a list of tensors into a single tensor. All input tensors must have the same shape, except for the dimension size of the axis to concatenate on.
11
22**Attributes****Attributes**
33
44* **axis** (required):* **axis** (required):
55 Which axis to concat on. A negative value means counting dimensions Which axis to concat on. A negative value means counting dimensions
66 from the back. Accepted range is [-r, r-1] where r = rank(inputs).. from the back. Accepted range is [-r, r-1] where r = rank(inputs)..
77
88**Inputs****Inputs**
99
1010Between 1 and 2147483647 inputs.Between 1 and 2147483647 inputs.
1111
1212* **inputs** (variadic, heterogeneous) - **T**:* **inputs** (variadic, heterogeneous) - **T**:
1313 List of tensors for concatenation List of tensors for concatenation
1414
1515**Outputs****Outputs**
1616
1717* **concat_result** (heterogeneous) - **T**:* **concat_result** (heterogeneous) - **T**:
1818 Concatenated tensor Concatenated tensor
1919
2020**Type Constraints****Type Constraints**
2121
2222* **T** in (* **T** in (
23 tensor(bfloat16),
2324 tensor(bool), tensor(bool),
2425 tensor(complex128), tensor(complex128),
2526 tensor(complex64), tensor(complex64),
2627 tensor(double), tensor(double),
2728 tensor(float), tensor(float),
2829 tensor(float16), tensor(float16),
2930 tensor(int16), tensor(int16),
3031 tensor(int32), tensor(int32),
3132 tensor(int64), tensor(int64),
3233 tensor(int8), tensor(int8),
3334 tensor(string), tensor(string),
3435 tensor(uint16), tensor(uint16),
3536 tensor(uint32), tensor(uint32),
3637 tensor(uint64), tensor(uint64),
3738 tensor(uint8) tensor(uint8)
3839 ): ):
3940 Constrain output types to any tensor type. Constrain output types to any tensor type.

Concat - 11#

Version

  • name: Concat (GitHub)

  • domain: main

  • since_version: 11

  • function: False

  • support_level: SupportType.COMMON

  • shape inference: True

This version of the operator has been available since version 11.

Summary

Concatenate a list of tensors into a single tensor. All input tensors must have the same shape, except for the dimension size of the axis to concatenate on.

Attributes

  • axis (required): Which axis to concat on. A negative value means counting dimensions from the back. Accepted range is [-r, r-1] where r = rank(inputs)..

Inputs

Between 1 and 2147483647 inputs.

  • inputs (variadic, heterogeneous) - T: List of tensors for concatenation

Outputs

  • concat_result (heterogeneous) - T: Concatenated tensor

Type Constraints

  • T in ( tensor(bool), tensor(complex128), tensor(complex64), tensor(double), tensor(float), tensor(float16), tensor(int16), tensor(int32), tensor(int64), tensor(int8), tensor(string), tensor(uint16), tensor(uint32), tensor(uint64), tensor(uint8) ): Constrain output types to any tensor type.

Differences

00Concatenate a list of tensors into a single tensorConcatenate a list of tensors into a single tensor. All input tensors must have the same shape, except for the dimension size of the axis to concatenate on.
11
22**Attributes****Attributes**
33
44* **axis** (required):* **axis** (required):
5 Which axis to concat on. A negative value means counting dimensions
56 Which axis to concat on from the back. Accepted range is [-r, r-1] where r = rank(inputs)..
67
78**Inputs****Inputs**
89
910Between 1 and 2147483647 inputs.Between 1 and 2147483647 inputs.
1011
1112* **inputs** (variadic, heterogeneous) - **T**:* **inputs** (variadic, heterogeneous) - **T**:
1213 List of tensors for concatenation List of tensors for concatenation
1314
1415**Outputs****Outputs**
1516
1617* **concat_result** (heterogeneous) - **T**:* **concat_result** (heterogeneous) - **T**:
1718 Concatenated tensor Concatenated tensor
1819
1920**Type Constraints****Type Constraints**
2021
2122* **T** in (* **T** in (
2223 tensor(bool), tensor(bool),
2324 tensor(complex128), tensor(complex128),
2425 tensor(complex64), tensor(complex64),
2526 tensor(double), tensor(double),
2627 tensor(float), tensor(float),
2728 tensor(float16), tensor(float16),
2829 tensor(int16), tensor(int16),
2930 tensor(int32), tensor(int32),
3031 tensor(int64), tensor(int64),
3132 tensor(int8), tensor(int8),
3233 tensor(string), tensor(string),
3334 tensor(uint16), tensor(uint16),
3435 tensor(uint32), tensor(uint32),
3536 tensor(uint64), tensor(uint64),
3637 tensor(uint8) tensor(uint8)
3738 ): ):
3839 Constrain output types to any tensor type. Constrain output types to any tensor type.

Concat - 4#

Version

  • name: Concat (GitHub)

  • domain: main

  • since_version: 4

  • function: False

  • support_level: SupportType.COMMON

  • shape inference: True

This version of the operator has been available since version 4.

Summary

Concatenate a list of tensors into a single tensor

Attributes

  • axis (required): Which axis to concat on

Inputs

Between 1 and 2147483647 inputs.

  • inputs (variadic, heterogeneous) - T: List of tensors for concatenation

Outputs

  • concat_result (heterogeneous) - T: Concatenated tensor

Type Constraints

  • T in ( tensor(bool), tensor(complex128), tensor(complex64), tensor(double), tensor(float), tensor(float16), tensor(int16), tensor(int32), tensor(int64), tensor(int8), tensor(string), tensor(uint16), tensor(uint32), tensor(uint64), tensor(uint8) ): Constrain output types to any tensor type.

Differences

00Concatenate a list of tensors into a single tensorConcatenate a list of tensors into a single tensor
11
22**Attributes****Attributes**
33
44* **axis**:* **axis** (required):
55 Which axis to concat on. Default value is 1. Which axis to concat on
66
77**Inputs****Inputs**
88
99Between 1 and 2147483647 inputs.Between 1 and 2147483647 inputs.
1010
1111* **inputs** (variadic, heterogeneous) - **T**:* **inputs** (variadic, heterogeneous) - **T**:
1212 List of tensors for concatenation List of tensors for concatenation
1313
1414**Outputs****Outputs**
1515
1616* **concat_result** (heterogeneous) - **T**:* **concat_result** (heterogeneous) - **T**:
1717 Concatenated tensor Concatenated tensor
1818
1919**Type Constraints****Type Constraints**
2020
2121* **T** in (* **T** in (
22 tensor(bool),
23 tensor(complex128),
24 tensor(complex64),
2225 tensor(double), tensor(double),
2326 tensor(float), tensor(float),
2427 tensor(float16) tensor(float16),
28 tensor(int16),
29 tensor(int32),
30 tensor(int64),
31 tensor(int8),
32 tensor(string),
33 tensor(uint16),
34 tensor(uint32),
35 tensor(uint64),
36 tensor(uint8)
2537 ): ):
2638 Constrain output types to float tensors. Constrain output types to any tensor type.

Concat - 1#

Version

  • name: Concat (GitHub)

  • domain: main

  • since_version: 1

  • function: False

  • support_level: SupportType.COMMON

  • shape inference: False

This version of the operator has been available since version 1.

Summary

Concatenate a list of tensors into a single tensor

Attributes

  • axis: Which axis to concat on. Default value is 1.

Inputs

Between 1 and 2147483647 inputs.

  • inputs (variadic, heterogeneous) - T: List of tensors for concatenation

Outputs

  • concat_result (heterogeneous) - T: Concatenated tensor

Type Constraints

  • T in ( tensor(double), tensor(float), tensor(float16) ): Constrain output types to float tensors.