SequenceMap#
Domain:
ai.onnxSince version: 17
Applies a sub-graph to each sample in the input sequence(s).
Inputs can be either tensors or sequences, with the exception of the first input which must be a sequence. The length of the first input sequence will determine the number of samples in the outputs. Any other sequence inputs should have the same number of samples. The number of inputs and outputs, should match the one of the subgraph.
For each i-th element in the output, a sample will be extracted from the input sequence(s) at the i-th position and the sub-graph will be applied to it. The outputs will contain the outputs of the sub-graph for each sample, in the same order as in the input.
This operator assumes that processing each sample is independent and could executed in parallel or in any order. Users cannot expect any specific ordering in which each subgraph is computed.
Inputs
input_sequence (S): Input sequence.
additional_inputs (V): Additional inputs to the graph
Outputs
out_sequence (S): Output sequence(s)
Type Constraints
S: Constrain input types to any sequence 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)).
V: Constrain to any tensor or sequence 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)), 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_sequence_map_add_1_sequence_1_tensor
Node:
SequenceMap(x0_seq, x1) -> (y0)
Attributes:
body = <subgraph>
Inputs:
x0_seq: shape=(4,), dtype=float32
[0., 1., 2., 3.]
x1: shape=(4,), dtype=float32
[-1., -2., -3., -4.]
input_2: shape=(4,), dtype=float32
[0.5, 1.5, 2.5, 3.5]
input_3: shape=(4,), dtype=float32
[100., 200., 300., 400.]
Outputs:
y0: sequence(len=3), element_shape=(4,), element_dtype=float32
[
[0] [100., 201., 302., 403.]
[1] [ 99., 198., 297., 396.]
[2] [100.5, 201.5, 302.5, 403.5]
]
test_cc_sequence_map_add_2_sequences
Node:
SequenceMap(x0_seq, x1_seq) -> (y0)
Attributes:
body = <subgraph>
Inputs:
x0_seq: shape=(4,), dtype=float32
[0., 1., 2., 3.]
x1_seq: shape=(4,), dtype=float32
[-1., -2., -3., -4.]
input_2: shape=(4,), dtype=float32
[0.5, 1.5, 2.5, 3.5]
input_3: shape=(4,), dtype=float32
[10., 10., 10., 10.]
input_4: shape=(4,), dtype=float32
[0.25, 0.5 , 0.75, 1. ]
input_5: shape=(4,), dtype=float32
[-0.5, -1.5, -2.5, -3.5]
Outputs:
y0: sequence(len=3), element_shape=(4,), element_dtype=float32
[
[0] [10., 11., 12., 13.]
[1] [-0.75, -1.5 , -2.25, -3. ]
[2] [0., 0., 0., 0.]
]
test_cc_sequence_map_extract_shapes
Node:
SequenceMap(in_seq) -> (shapes)
Attributes:
body = <subgraph>
Inputs:
in_seq: shape=(4, 3, 2), dtype=float32
[[[0., 0.],
[0., 0.],
[0., 0.]],
[[0., 0.],
[0., 0.],
[0., 0.]],
[[0., 0.],
[0., 0.],
[0., 0.]],
[[0., 0.],
[0., 0.],
[0., 0.]]]
input_1: shape=(2, 5, 1), dtype=float32
[[[0.],
[0.],
[0.],
[0.],
[0.]],
[[0.],
[0.],
[0.],
[0.],
[0.]]]
input_2: shape=(1, 1, 7), dtype=float32
[[[0., 0., 0., 0., 0., 0., 0.]]]
Outputs:
shapes: sequence(len=3), element_shape=(3,), element_dtype=int64
[
[0] [4, 3, 2]
[1] [2, 5, 1]
[2] [1, 1, 7]
]
test_cc_sequence_map_identity_1_sequence
Node:
SequenceMap(input_seq) -> (output_sequence)
Attributes:
body = <subgraph>
Inputs:
input_seq: shape=(10,), dtype=float32
[0., 1., 2., 3., 4., 5., 6., 7., 8., 9.]
input_1: shape=(10,), dtype=float32
[-0.5, -1. , -1.5, -2. , -2.5, -3. , -3.5, -4. , -4.5, -5. ]
input_2: shape=(10,), dtype=float32
[0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1. ]
Outputs:
output_sequence: sequence(len=3), element_shape=(10,), element_dtype=float32
[
[0] [0., 1., 2., 3., 4., 5., 6., 7., 8., 9.]
[1] [-0.5, -1. , -1.5, -2. , -2.5, -3. , -3.5, -4. , -4.5, -5. ]
[2] [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1. ]
]
test_cc_sequence_map_identity_1_sequence_1_tensor
Node:
SequenceMap(x0_seq, x1) -> (y0, y1)
Attributes:
body = <subgraph>
Inputs:
x0_seq: shape=(5,), dtype=float32
[0., 1., 2., 3., 4.]
x1: shape=(5,), dtype=float32
[-0.5, -1. , -1.5, -2. , -2.5]
input_2: shape=(5,), dtype=float32
[5., 6., 7., 8., 9.]
input_3: shape=(4,), dtype=float32
[10., 20., 30., 40.]
Outputs:
y0: sequence(len=3), element_shape=(5,), element_dtype=float32
[
[0] [0., 1., 2., 3., 4.]
[1] [-0.5, -1. , -1.5, -2. , -2.5]
[2] [5., 6., 7., 8., 9.]
]
y1: sequence(len=3), element_shape=(4,), element_dtype=float32
[
[0] [10., 20., 30., 40.]
[1] [10., 20., 30., 40.]
[2] [10., 20., 30., 40.]
]
test_cc_sequence_map_identity_2_sequences
Node:
SequenceMap(x0_seq, x1_seq) -> (y0, y1)
Attributes:
body = <subgraph>
Inputs:
x0_seq: shape=(3,), dtype=float32
[0., 1., 2.]
x1_seq: shape=(3,), dtype=float32
[-0.5, 1.5, 2.5]
input_2: shape=(3,), dtype=float32
[10., 20., 30.]
input_3: shape=(4,), dtype=float32
[0., 1., 2., 3.]
input_4: shape=(4,), dtype=float32
[0.25, 0.5 , 0.75, 1. ]
input_5: shape=(4,), dtype=float32
[-1., -2., -3., -4.]
Outputs:
y0: sequence(len=3), element_shape=(3,), element_dtype=float32
[
[0] [0., 1., 2.]
[1] [-0.5, 1.5, 2.5]
[2] [10., 20., 30.]
]
y1: sequence(len=3), element_shape=(4,), element_dtype=float32
[
[0] [0., 1., 2., 3.]
[1] [0.25, 0.5 , 0.75, 1. ]
[2] [-1., -2., -3., -4.]
]
test_cc_sequence_map_identity_float
Node:
SequenceMap(input_seq) -> (output_sequence)
Attributes:
body = <subgraph>
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:
output_sequence: sequence(len=3), element_shape=(2, 3), element_dtype=float32
[
[0] [[-1. , 0. , 1.5 ],
[-2.25, 3.5 , -4.75]]
[1] [[0., 1., 2.],
[3., 4., 5.]]
[2] [[ 6., 7., 8.],
[ 9., 10., 11.]]
]
test_cc_sequence_map_identity_int64
Node:
SequenceMap(input_seq) -> (output_sequence)
Attributes:
body = <subgraph>
Inputs:
input_seq: shape=(4,), dtype=int64
[-1, 0, 1, 2]
input_1: shape=(4,), dtype=int64
[3, 4, 5, 6]
Outputs:
output_sequence: sequence(len=2), element_shape=(4,), element_dtype=int64
[
[0] [-1, 0, 1, 2]
[1] [3, 4, 5, 6]
]