Skip to content

Commit

Permalink
add parser support for GREATER tflite operator (apache#3963)
Browse files Browse the repository at this point in the history
add test for GREATER
  • Loading branch information
inadob authored and wweic committed Sep 30, 2019
1 parent 8001aa3 commit 17bafdf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions python/tvm/relay/frontend/tflite.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ def __init__(self, model, subgraph, exp_tab):
'POW': self.convert_pow,
'MAXIMUM': self.convert_maximum,
'MINIMUM': self.convert_minimum,
'GREATER': self.convert_greater,
'REDUCE_MIN': self._convert_reduce_min,
'REDUCE_MAX': self._convert_reduce_max,
'MEAN': self._convert_reduce_mean,
Expand Down Expand Up @@ -456,6 +457,9 @@ def convert_maximum(self, op):
def convert_minimum(self, op):
return self._convert_elemwise(_op.minimum, op)

def convert_greater(self, op):
return self._convert_elemwise(_op.greater, op)

def _convert_reduce(self, relay_op, op):
"""Generic method to Convert TFLite MEAN operators"""
try:
Expand Down
8 changes: 8 additions & 0 deletions tests/python/frontend/tflite/test_forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,13 @@ def _test_maximum(data):
def _test_minimum(data):
""" One iteration of minimum """
return _test_elemwise(math_ops.minimum, data)
#######################################################################
# Greater
# -------

def _test_greater(data):
""" One iteration of greater """
return _test_elemwise(math_ops.greater, data)

def _test_forward_elemwise(testop):
""" Elewise"""
Expand All @@ -623,6 +630,7 @@ def test_all_elemwise():
_test_forward_elemwise(_test_pow)
_test_forward_elemwise(_test_maximum)
_test_forward_elemwise(_test_minimum)
_test_forward_elemwise(_test_greater)

#######################################################################
# Reduce
Expand Down

0 comments on commit 17bafdf

Please sign in to comment.