SequenceConstruct#

  • Domain: ai.onnx

  • Since version: 11

Construct a tensor sequence containing ‘inputs’ tensors. All tensors in ‘inputs’ must have the same data type.

Inputs

  • inputs (T): Tensors.

Outputs

  • output_sequence (S): Sequence enclosing the input tensors.

Type Constraints

  • T: Constrain input 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).

  • S: Constrain output 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)).

Examples#

test_cc_concat_from_sequence_axis_0

Node:
  SequenceConstruct(a, b, c) -> (input_seq)
Inputs:
  a: shape=(2, 3), dtype=float32
    [[-1.  ,  0.  ,  1.5 ],
     [-2.25,  3.5 , -4.75]]
  b: shape=(2, 3), dtype=float32
    [[0., 1., 2.],
     [3., 4., 5.]]
  c: shape=(2, 3), dtype=float32
    [[ 6.,  7.,  8.],
     [ 9., 10., 11.]]

Outputs:
  input_seq: 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:
  SequenceConstruct(a, b, c) -> (input_seq)
Inputs:
  a: shape=(2, 3), dtype=float32
    [[-1.  ,  0.  ,  1.5 ],
     [-2.25,  3.5 , -4.75]]
  b: shape=(2, 3), dtype=float32
    [[0., 1., 2.],
     [3., 4., 5.]]
  c: shape=(2, 3), dtype=float32
    [[ 6.,  7.,  8.],
     [ 9., 10., 11.]]

Outputs:
  input_seq: 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:
  SequenceConstruct(a, b, c) -> (input_seq)
Inputs:
  a: shape=(2, 3), dtype=float32
    [[-1.  ,  0.  ,  1.5 ],
     [-2.25,  3.5 , -4.75]]
  b: shape=(2, 3), dtype=float32
    [[0., 1., 2.],
     [3., 4., 5.]]
  c: shape=(2, 3), dtype=float32
    [[ 6.,  7.,  8.],
     [ 9., 10., 11.]]

Outputs:
  input_seq: 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.  ]]]

test_cc_sequence_at_neg

Node:
  SequenceConstruct(a, b, c) -> (input_seq)
Inputs:
  a: shape=(2, 3), dtype=float32
    [[-1.  ,  0.  ,  1.5 ],
     [-2.25,  3.5 , -4.75]]
  b: shape=(2, 3), dtype=float32
    [[0., 1., 2.],
     [3., 4., 5.]]
  c: shape=(2, 3), dtype=float32
    [[ 6.,  7.,  8.],
     [ 9., 10., 11.]]
  input_3: shape=(), dtype=int64
    -2

Outputs:
  input_seq: shape=(2, 3), dtype=float32
    [[0., 1., 2.],
     [3., 4., 5.]]

test_cc_sequence_at_pos0

Node:
  SequenceConstruct(a, b, c) -> (input_seq)
Inputs:
  a: shape=(2, 3), dtype=float32
    [[-1.  ,  0.  ,  1.5 ],
     [-2.25,  3.5 , -4.75]]
  b: shape=(2, 3), dtype=float32
    [[0., 1., 2.],
     [3., 4., 5.]]
  c: shape=(2, 3), dtype=float32
    [[ 6.,  7.,  8.],
     [ 9., 10., 11.]]
  input_3: shape=(), dtype=int64
    0

Outputs:
  input_seq: shape=(2, 3), dtype=float32
    [[-1.  ,  0.  ,  1.5 ],
     [-2.25,  3.5 , -4.75]]

test_cc_sequence_at_pos2

Node:
  SequenceConstruct(a, b, c) -> (input_seq)
Inputs:
  a: shape=(2, 3), dtype=float32
    [[-1.  ,  0.  ,  1.5 ],
     [-2.25,  3.5 , -4.75]]
  b: shape=(2, 3), dtype=float32
    [[0., 1., 2.],
     [3., 4., 5.]]
  c: shape=(2, 3), dtype=float32
    [[ 6.,  7.,  8.],
     [ 9., 10., 11.]]
  input_3: shape=(), dtype=int64
    2

Outputs:
  input_seq: shape=(2, 3), dtype=float32
    [[ 6.,  7.,  8.],
     [ 9., 10., 11.]]

test_cc_sequence_construct

Node:
  SequenceConstruct(a, b, c) -> (output_sequence)
Inputs:
  a: shape=(2, 3), dtype=float32
    [[-1.  ,  0.  ,  1.5 ],
     [-2.25,  3.5 , -4.75]]
  b: shape=(2, 3), dtype=float32
    [[0., 1., 2.],
     [3., 4., 5.]]
  c: 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_construct_int64_single

Node:
  SequenceConstruct(a) -> (output_sequence)
Inputs:
  a: shape=(4,), dtype=int64
    [-1,  0,  1,  2]

Outputs:
  output_sequence: sequence(len=1), element_shape=(4,), element_dtype=int64
    [
      [0] [-1,  0,  1,  2]
    ]

test_cc_sequence_erase_default

Node:
  SequenceConstruct(a, b, c) -> (input_seq)
Inputs:
  a: shape=(2, 3), dtype=float32
    [[-1.  ,  0.  ,  1.5 ],
     [-2.25,  3.5 , -4.75]]
  b: shape=(2, 3), dtype=float32
    [[0., 1., 2.],
     [3., 4., 5.]]
  c: shape=(2, 3), dtype=float32
    [[ 6.,  7.,  8.],
     [ 9., 10., 11.]]

Outputs:
  input_seq: sequence(len=2), 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.]]
    ]

test_cc_sequence_erase_neg

Node:
  SequenceConstruct(a, b, c) -> (input_seq)
Inputs:
  a: shape=(2, 3), dtype=float32
    [[-1.  ,  0.  ,  1.5 ],
     [-2.25,  3.5 , -4.75]]
  b: shape=(2, 3), dtype=float32
    [[0., 1., 2.],
     [3., 4., 5.]]
  c: shape=(2, 3), dtype=float32
    [[ 6.,  7.,  8.],
     [ 9., 10., 11.]]
  input_3: shape=(), dtype=int64
    -2

Outputs:
  input_seq: sequence(len=2), element_shape=(2, 3), element_dtype=float32
    [
      [0] [[-1.  ,  0.  ,  1.5 ],
           [-2.25,  3.5 , -4.75]]
      [1] [[ 6.,  7.,  8.],
           [ 9., 10., 11.]]
    ]

test_cc_sequence_erase_pos1

Node:
  SequenceConstruct(a, b, c) -> (input_seq)
Inputs:
  a: shape=(2, 3), dtype=float32
    [[-1.  ,  0.  ,  1.5 ],
     [-2.25,  3.5 , -4.75]]
  b: shape=(2, 3), dtype=float32
    [[0., 1., 2.],
     [3., 4., 5.]]
  c: shape=(2, 3), dtype=float32
    [[ 6.,  7.,  8.],
     [ 9., 10., 11.]]
  input_3: shape=(), dtype=int64
    1

Outputs:
  input_seq: sequence(len=2), element_shape=(2, 3), element_dtype=float32
    [
      [0] [[-1.  ,  0.  ,  1.5 ],
           [-2.25,  3.5 , -4.75]]
      [1] [[ 6.,  7.,  8.],
           [ 9., 10., 11.]]
    ]

test_cc_sequence_insert_at_back

Node:
  SequenceConstruct(i0, i1, i2) -> (input_seq)
Inputs:
  i0: shape=(3,), dtype=int64
    [1, 2, 3]
  i1: shape=(3,), dtype=int64
    [4, 5, 6]
  i2: shape=(3,), dtype=int64
    [7, 8, 9]
  input_3: shape=(3,), dtype=int64
    [10, 11, 12]

Outputs:
  input_seq: sequence(len=4), element_shape=(3,), element_dtype=int64
    [
      [0] [1, 2, 3]
      [1] [4, 5, 6]
      [2] [7, 8, 9]
      [3] [10, 11, 12]
    ]

test_cc_sequence_insert_at_front

Node:
  SequenceConstruct(i0, i1, i2) -> (input_seq)
Inputs:
  i0: shape=(3,), dtype=int64
    [1, 2, 3]
  i1: shape=(3,), dtype=int64
    [4, 5, 6]
  i2: shape=(3,), dtype=int64
    [7, 8, 9]
  input_3: shape=(3,), dtype=int64
    [10, 11, 12]
  input_4: shape=(), dtype=int64
    0

Outputs:
  input_seq: sequence(len=4), element_shape=(3,), element_dtype=int64
    [
      [0] [10, 11, 12]
      [1] [1, 2, 3]
      [2] [4, 5, 6]
      [3] [7, 8, 9]
    ]

test_cc_sequence_insert_default

Node:
  SequenceConstruct(a, b, c) -> (input_seq)
Inputs:
  a: shape=(2, 3), dtype=float32
    [[-1.  ,  0.  ,  1.5 ],
     [-2.25,  3.5 , -4.75]]
  b: shape=(2, 3), dtype=float32
    [[0., 1., 2.],
     [3., 4., 5.]]
  c: shape=(2, 3), dtype=float32
    [[ 6.,  7.,  8.],
     [ 9., 10., 11.]]
  input_3: shape=(2, 3), dtype=float32
    [[12., 13., 14.],
     [15., 16., 17.]]

Outputs:
  input_seq: sequence(len=4), 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.]]
      [3] [[12., 13., 14.],
           [15., 16., 17.]]
    ]

test_cc_sequence_insert_neg

Node:
  SequenceConstruct(a, b, c) -> (input_seq)
Inputs:
  a: shape=(2, 3), dtype=float32
    [[-1.  ,  0.  ,  1.5 ],
     [-2.25,  3.5 , -4.75]]
  b: shape=(2, 3), dtype=float32
    [[0., 1., 2.],
     [3., 4., 5.]]
  c: shape=(2, 3), dtype=float32
    [[ 6.,  7.,  8.],
     [ 9., 10., 11.]]
  input_3: shape=(2, 3), dtype=float32
    [[12., 13., 14.],
     [15., 16., 17.]]
  input_4: shape=(), dtype=int64
    -1

Outputs:
  input_seq: sequence(len=4), 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] [[12., 13., 14.],
           [15., 16., 17.]]
      [3] [[ 6.,  7.,  8.],
           [ 9., 10., 11.]]
    ]

test_cc_sequence_insert_pos1

Node:
  SequenceConstruct(a, b, c) -> (input_seq)
Inputs:
  a: shape=(2, 3), dtype=float32
    [[-1.  ,  0.  ,  1.5 ],
     [-2.25,  3.5 , -4.75]]
  b: shape=(2, 3), dtype=float32
    [[0., 1., 2.],
     [3., 4., 5.]]
  c: shape=(2, 3), dtype=float32
    [[ 6.,  7.,  8.],
     [ 9., 10., 11.]]
  input_3: shape=(2, 3), dtype=float32
    [[12., 13., 14.],
     [15., 16., 17.]]
  input_4: shape=(), dtype=int64
    1

Outputs:
  input_seq: sequence(len=4), element_shape=(2, 3), element_dtype=float32
    [
      [0] [[-1.  ,  0.  ,  1.5 ],
           [-2.25,  3.5 , -4.75]]
      [1] [[12., 13., 14.],
           [15., 16., 17.]]
      [2] [[0., 1., 2.],
           [3., 4., 5.]]
      [3] [[ 6.,  7.,  8.],
           [ 9., 10., 11.]]
    ]

test_cc_sequence_length

Node:
  SequenceConstruct(a, b, c) -> (input_seq)
Inputs:
  a: shape=(2, 3), dtype=float32
    [[-1.  ,  0.  ,  1.5 ],
     [-2.25,  3.5 , -4.75]]
  b: shape=(2, 3), dtype=float32
    [[0., 1., 2.],
     [3., 4., 5.]]
  c: shape=(2, 3), dtype=float32
    [[ 6.,  7.,  8.],
     [ 9., 10., 11.]]

Outputs:
  input_seq: shape=(), dtype=int64
    3