Skip to content

Commit

Permalink
Fix for issue apache#4831. The data_min_idx and data_max_idx were fli…
Browse files Browse the repository at this point in the history
…pped.

Existing test cases cover this fix. In addition I have added an assert to make sure that the data_min is always less than equal to data_max.
  • Loading branch information
shoubhik committed Mar 23, 2020
1 parent 2adcb73 commit 3f56a0c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions python/tvm/relay/frontend/mxnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -1229,6 +1229,7 @@ def _get_data_scale_and_zp(_data, _inputs,
""" Finds the Qnn params for the data expr. """
data_min = _inputs[_data_min_idx]
data_max = _inputs[_data_max_idx]
assert data_min <= data_max
data_dtype = _infer_type(_data).checked_type.dtype
assert data_dtype in {'int8', 'uint8'}
if data_min < 0.0:
Expand Down Expand Up @@ -1420,8 +1421,8 @@ def _parse():
###############################################
# Last 2 indexes are data min and max. If the conv has a sum, then last 2 indexes are
# for the second tensor. So, the data min max indexes are last 3 and 4
data_min_idx = -1
data_max_idx = -2
data_min_idx = -2
data_max_idx = -1
if has_sum:
data_min_idx = -4
data_max_idx = -3
Expand Down

0 comments on commit 3f56a0c

Please sign in to comment.