SequenceErase#

  • Domain: ai.onnx

  • Since version: 11

Outputs a tensor sequence that removes the tensor at ‘position’ from ‘input_sequence’. Accepted range for ‘position’ is in [-n, n - 1], where n is the number of tensors in ‘input_sequence’. Negative value means counting positions from the back. ‘position’ is optional, by default it erases the last tensor from ‘input_sequence’.

Inputs

  • input_sequence (S): Input sequence.

  • position (I): Position of the tensor in the sequence. Negative value means counting positions from the back. Accepted range in [-n, n - 1], where n is the number of tensors in ‘input_sequence’. It is an error if any of the index values are out of bounds. It must be a scalar(tensor of empty shape).

Outputs

  • output_sequence (S): Output sequence that has the tensor at the specified position removed.

Type Constraints

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

  • I: Constrain position to integral tensor. It must be a scalar(tensor of empty shape). Allowed types: tensor(int32), tensor(int64).

Examples#

test_cc_sequence_erase_default

Node:
  SequenceErase(input_seq) -> (output_sequence)
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=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:
  SequenceErase(input_seq, position) -> (output_sequence)
Inputs:
  input_seq: shape=(2, 3), dtype=float32
    [[-1.  ,  0.  ,  1.5 ],
     [-2.25,  3.5 , -4.75]]
  position: shape=(2, 3), dtype=float32
    [[0., 1., 2.],
     [3., 4., 5.]]
  input_2: shape=(2, 3), dtype=float32
    [[ 6.,  7.,  8.],
     [ 9., 10., 11.]]
  input_3: shape=(), dtype=int64
    -2

Outputs:
  output_sequence: 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:
  SequenceErase(input_seq, position) -> (output_sequence)
Inputs:
  input_seq: shape=(2, 3), dtype=float32
    [[-1.  ,  0.  ,  1.5 ],
     [-2.25,  3.5 , -4.75]]
  position: shape=(2, 3), dtype=float32
    [[0., 1., 2.],
     [3., 4., 5.]]
  input_2: shape=(2, 3), dtype=float32
    [[ 6.,  7.,  8.],
     [ 9., 10., 11.]]
  input_3: shape=(), dtype=int64
    1

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