Skip to content

Commit

Permalink
add assert
Browse files Browse the repository at this point in the history
  • Loading branch information
Valery Chernov committed Jan 30, 2023
1 parent 7d5eb28 commit e6259d9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions python/tvm/relay/frontend/onnx.py
Original file line number Diff line number Diff line change
Expand Up @@ -6168,10 +6168,13 @@ def _impl_v11(cls, inputs, attr, params):
else:
position = -1

seq_len = len(input_sequence)
assert -seq_len <= position and position < seq_len, "Position is out of bounds"

if position < 0:
position = len(input_sequence) + position
position = seq_len + position
# Convert sequence to a list, insert tensors before erased, and repackage as Tuple.
tensor_list = [input_sequence[i] for i in range(len(input_sequence)) if i != position]
tensor_list = [input_sequence[i] for i in range(seq_len) if i != position]
# Create new tuple and return.
return _expr.Tuple(tensor_list)

Expand Down

0 comments on commit e6259d9

Please sign in to comment.