Commit b08fe810 by Ina Dobreva Committed by Tianqi Chen

Add parser support for SUM tflite operator (#4182)

parent e74a0eb6
......@@ -82,6 +82,7 @@ class OperatorConverter(object):
'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 @@ class OperatorConverter(object):
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:
......
......@@ -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_sum """
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)
#######################################################################
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment