codeislife99 commented on a change in pull request #7562:
URL: https://github.com/apache/tvm/pull/7562#discussion_r587020745
##########
File path: python/tvm/relay/frontend/tensorflow.py
##########
@@ -1166,6 +1166,125 @@ def _impl(inputs, attr, params, mod):
return _impl
+def _math_segment_sum():
+ def _impl(inputs, attr, params, mod):
+ assert len(inputs) == 2, "There should be 2 input tensors"
+ return get_relay_op("segment_sum")(inputs[0], inputs[1])
+
+ return _impl
+
+
+def _sparse_segment_sum():
+ def _impl(inputs, attr, params, mod):
+ assert len(inputs) == 3, "There should be 3 input tensors"
+ data = _op.take(inputs[0], inputs[1], axis=0)
+ return _op.segment_sum(data, inputs[2])
+
Review comment:
I am using scatter_add in the relay op but how would you combine take
with it to generate one op. I am still trying to find out.
##########
File path: python/tvm/relay/frontend/tensorflow.py
##########
@@ -1166,6 +1166,125 @@ def _impl(inputs, attr, params, mod):
return _impl
+def _math_segment_sum():
+ def _impl(inputs, attr, params, mod):
+ assert len(inputs) == 2, "There should be 2 input tensors"
+ return get_relay_op("segment_sum")(inputs[0], inputs[1])
+
+ return _impl
+
+
+def _sparse_segment_sum():
+ def _impl(inputs, attr, params, mod):
+ assert len(inputs) == 3, "There should be 3 input tensors"
+ data = _op.take(inputs[0], inputs[1], axis=0)
+ return _op.segment_sum(data, inputs[2])
+
Review comment:
AFAIK, Scatter_nd and scatter_add are the same op, just with zero
initialization as the difference.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]