Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions python/tvm/relay/frontend/tflite.py
Original file line number Diff line number Diff line change
Expand Up @@ -1666,7 +1666,7 @@ def _transform_mask(stride_dim, ellipsis_mask):
if begin[index] < 0
else begin[index]
)
m_end[final_index] = begin[index] + 1
m_end[final_index] = m_begin[final_index] + 1
m_stride[final_index] = 1
fshape_indices.append(-2)
else:
Expand Down Expand Up @@ -2704,9 +2704,9 @@ def convert_unpack(self, op):
unpack_axis = unpack_options.Axis()

# Relay doesn't support 'unpack' operator so we use 'split' & 'squeeze' instead.
# We have to do 'squeeze' along the split axis but Relay expects
# squeeze_axis to be either None or List.
squeeze_axis = None if unpack_axis == 0 else [unpack_axis]
# We have to do 'squeeze' along the split axis.
# Relay expects squeeze_axis to be List.
squeeze_axis = [unpack_axis]

# Relay doesn't like TupleWrapper of 1 element so we isolate the case of unpacking
# a tensor by an axis with len(axis) == 1. For reference see convert_split().
Expand Down
6 changes: 6 additions & 0 deletions tests/python/frontend/tflite/test_forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,9 @@ def test_forward_stridedslice():
_test_stridedslice(
(4, 4), [1, 0], [4, 4], [1, 1], "float32", shrink_axis_mask=2, quantized=quantized
)
_test_stridedslice(
(3, 4), [-1, 0], [0, 3], [1, 1], "float32", shrink_axis_mask=1, quantized=quantized
)


#######################################################################
Expand Down Expand Up @@ -3186,6 +3189,9 @@ def test_forward_unpack():
"""UNPACK"""
_test_unpack(np.array(np.random.uniform(0, 5, (3, 1)), dtype=np.int32), axis=1, num_unpacks=1)
_test_unpack(np.array(np.random.uniform(0, 5, (3, 4)), dtype=np.float32), axis=0, num_unpacks=3)
_test_unpack(
np.array(np.random.uniform(0, 5, (3, 1, 2)), dtype=np.float32), axis=0, num_unpacks=3
)
# tflite 1.13 doesn't accept negative axis
if package_version.parse(tf.VERSION) >= package_version.parse("1.14.0"):
_test_unpack(
Expand Down