diff --git a/python/tvm/relay/frontend/tflite.py b/python/tvm/relay/frontend/tflite.py index b08dd6bf94e04..b042af9fbe65d 100644 --- a/python/tvm/relay/frontend/tflite.py +++ b/python/tvm/relay/frontend/tflite.py @@ -82,6 +82,7 @@ def __init__(self, model, subgraph, exp_tab): 'REDUCE_MAX': self._convert_reduce_max, 'MEAN': self._convert_reduce_mean, 'REDUCE_PROD': self._convert_reduce_prod, + 'SUM': self._convert_reduce_sum, 'FULLY_CONNECTED': self.convert_fully_connected, 'PAD': self.convert_pad, 'PACK': self.convert_pack, @@ -672,6 +673,9 @@ def _convert_reduce_mean(self, op): def _convert_reduce_prod(self, op): return self._convert_reduce(_op.reduce.prod, op) + def _convert_reduce_sum(self, op): + return self._convert_reduce(_op.reduce.sum, op) + def convert_fully_connected(self, op): """Convert TFLite fully connected""" try: diff --git a/tests/python/frontend/tflite/test_forward.py b/tests/python/frontend/tflite/test_forward.py index 29b0c87c5b323..28c8401026bc1 100644 --- a/tests/python/frontend/tflite/test_forward.py +++ b/tests/python/frontend/tflite/test_forward.py @@ -714,6 +714,14 @@ def _test_reduce_prod(data, keep_dims=None): """ One iteration of reduce_prod """ return _test_reduce(math_ops.reduce_prod, data, keep_dims) +####################################################################### +# Reduce_sum +# ----------- + +def _test_reduce_sum(data, keep_dims=None): + """ One iteration of reduce_prod """ + return _test_reduce(math_ops.reduce_sum, data, keep_dims) + def _test_forward_reduce(testop): """ Reduce """ @@ -732,6 +740,7 @@ def test_all_reduce(): _test_forward_reduce(_test_reduce_max) _test_forward_reduce(_test_reduce_mean) _test_forward_reduce(_test_reduce_prod) + _test_forward_reduce(_test_reduce_sum) #######################################################################