ConcatFromSequence#
Domain:
ai.onnxSince version: 11
Concatenate a sequence 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. By default ‘new_axis’ is 0, the behavior is similar to numpy.concatenate. When ‘new_axis’ is 1, the behavior is similar to numpy.stack.
Inputs
input_sequence (S): Sequence of tensors for concatenation
Outputs
concat_result (T): Concatenated tensor
Attributes
axis (int): Which axis to concat on. Accepted range in
[-r, r - 1], whereris the rank of input tensors. Whennew_axisis 1, accepted range is[-r - 1, r].new_axis (int): Insert and concatenate on a new axis or not, default 0 means do not insert new axis.
Type Constraints
S: Constrain input types to any tensor type. Allowed types: seq(tensor(bool)), seq(tensor(complex128)), seq(tensor(complex64)), seq(tensor(double)), seq(tensor(float)), seq(tensor(float16)), seq(tensor(int16)), seq(tensor(int32)), seq(tensor(int64)), seq(tensor(int8)), seq(tensor(string)), seq(tensor(uint16)), seq(tensor(uint32)), seq(tensor(uint64)), seq(tensor(uint8)).
T: Constrain output types to any tensor type. Allowed types: 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).
Examples#
test_cc_concat_from_sequence_axis_0
Node:
ConcatFromSequence(input_seq) -> (concat_result)
Attributes:
axis = 0
Inputs:
input_seq: shape=(2, 3), dtype=float32
[[-1. , 0. , 1.5 ],
[-2.25, 3.5 , -4.75]]
input_1: shape=(2, 3), dtype=float32
[[0., 1., 2.],
[3., 4., 5.]]
input_2: shape=(2, 3), dtype=float32
[[ 6., 7., 8.],
[ 9., 10., 11.]]
Outputs:
concat_result: shape=(6, 3), dtype=float32
[[-1. , 0. , 1.5 ],
[-2.25, 3.5 , -4.75],
[ 0. , 1. , 2. ],
[ 3. , 4. , 5. ],
[ 6. , 7. , 8. ],
[ 9. , 10. , 11. ]]
test_cc_concat_from_sequence_axis_1
Node:
ConcatFromSequence(input_seq) -> (concat_result)
Attributes:
axis = 1
Inputs:
input_seq: shape=(2, 3), dtype=float32
[[-1. , 0. , 1.5 ],
[-2.25, 3.5 , -4.75]]
input_1: shape=(2, 3), dtype=float32
[[0., 1., 2.],
[3., 4., 5.]]
input_2: shape=(2, 3), dtype=float32
[[ 6., 7., 8.],
[ 9., 10., 11.]]
Outputs:
concat_result: shape=(2, 9), dtype=float32
[[-1. , 0. , 1.5 , 0. , 1. , 2. , 6. , 7. , 8. ],
[-2.25, 3.5 , -4.75, 3. , 4. , 5. , 9. , 10. , 11. ]]
test_cc_concat_from_sequence_new_axis
Node:
ConcatFromSequence(input_seq) -> (concat_result)
Attributes:
axis = 0
new_axis = 1
Inputs:
input_seq: shape=(2, 3), dtype=float32
[[-1. , 0. , 1.5 ],
[-2.25, 3.5 , -4.75]]
input_1: shape=(2, 3), dtype=float32
[[0., 1., 2.],
[3., 4., 5.]]
input_2: shape=(2, 3), dtype=float32
[[ 6., 7., 8.],
[ 9., 10., 11.]]
Outputs:
concat_result: shape=(3, 2, 3), dtype=float32
[[[-1. , 0. , 1.5 ],
[-2.25, 3.5 , -4.75]],
[[ 0. , 1. , 2. ],
[ 3. , 4. , 5. ]],
[[ 6. , 7. , 8. ],
[ 9. , 10. , 11. ]]]