Skip to content

Commit

Permalink
[TFLite] Fix detection of crop in convert_batch_to_space_nd (apache#6670
Browse files Browse the repository at this point in the history
)
  • Loading branch information
Trevor Morris authored and trevor-m committed Dec 4, 2020
1 parent 0c74497 commit 733dff8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion python/tvm/relay/frontend/tflite.py
Original file line number Diff line number Diff line change
Expand Up @@ -2601,7 +2601,7 @@ def convert_batch_to_space_nd(self, op):
cropped = reshaped_permuted
for axis in range(1, M + 1):
crop = crops[axis - 1]
if (crop != [0, 0]).all():
if (crop != [0, 0]).any():
indices = _op.arange(
_expr.const(crop[0]),
_expr.const(reshaped_permuted_shape[axis] - crop[1]),
Expand Down
2 changes: 2 additions & 0 deletions tests/python/frontend/tflite/test_forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -706,6 +706,8 @@ def test_forward_batch_to_space_nd():

_test_batch_to_space_nd(input_shape=[4, 2, 2, 1], block_shape=[2, 2], crops=[[0, 0], [0, 0]])

_test_batch_to_space_nd(input_shape=[4, 3, 3, 1], block_shape=[2, 2], crops=[[0, 1], [0, 1]])


######################################################################
# SpaceToBatchND
Expand Down

0 comments on commit 733dff8

Please sign in to comment.