Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TFLite][Frontend] Support quantized GREATER_EQUAL #15775

Merged
merged 8 commits into from
Sep 21, 2023
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: 3 additions & 5 deletions python/tvm/relay/frontend/tflite.py
Original file line number Diff line number Diff line change
Expand Up @@ -1474,11 +1474,9 @@ def convert_squared_difference(self, op):

def convert_greater_equal(self, op):
"""Convert TFLite GREATER_EQUAL"""
if self.is_quantized(op):
raise tvm.error.OpNotImplemented(
"TFlite quantized GREATER_EQUAL operator is not supported yet."
)
return self._convert_elemwise(_op.greater_equal, op)
return self._convert_elemwise(
_op.greater_equal, op, self.is_quantized(op), comparison_op=True
)

def convert_less(self, op):
"""Convert TFLite LESS"""
Expand Down
14 changes: 12 additions & 2 deletions tests/python/frontend/tflite/test_forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -2679,9 +2679,17 @@ def _test_greater(data, fused_activation_function=None, quantized=False, qnn_op=
# -------------


def _test_greater_equal(data):
def _test_greater_equal(data, fused_activation_function=None, quantized=False, qnn_op=None):
"""One iteration of greater_equal"""
return _test_elemwise(math_ops.greater_equal, data)
return _test_elemwise(
math_ops.greater_equal,
data,
fused_activation_function,
quantized,
qnn_op,
same_qnn_params=True,
comparison_op=True,
)


#######################################################################
Expand Down Expand Up @@ -2850,6 +2858,7 @@ def _test_elemwise_qnn_out_range(qnn_op):
_test_less: (-150, 150),
_test_floor_mod: (-150, 150),
_test_not_equal: (-150, 150),
_test_greater_equal: (-150, 150),
}

return qnn_out_range[qnn_op]
Expand Down Expand Up @@ -2885,6 +2894,7 @@ def test_all_elemwise():
_test_forward_elemwise(_test_squared_difference)
_test_forward_elemwise_quantized(_test_squared_difference, np.int8)
_test_forward_elemwise(_test_greater_equal)
_test_forward_elemwise_quantized(_test_greater_equal)
_test_forward_elemwise(_test_less)
_test_forward_elemwise_quantized(_test_less)
_test_forward_elemwise(_test_less_equal)
Expand Down
Loading