altanh commented on a change in pull request #6767:
URL: https://github.com/apache/incubator-tvm/pull/6767#discussion_r512887971



##########
File path: python/tvm/relay/op/_tensor_grad.py
##########
@@ -665,3 +673,115 @@ def cross_entropy_with_logits_grad(orig, grad):
     batch_size = take(shape, const(0, dtype="int32"), axis=0)
     grad = grad / batch_size.astype(x.checked_type.dtype)
     return [-grad * y, -grad * x]
+
+
+@register_gradient("take")
+def take_grad(orig, grad):

Review comment:
       This is a good point that I was wondering about. The loop is basically 
just implementing a `put` operation (like I described in the comment), so it 
would make sense to have it be a separate op since I imagine it will be useful 
in general. Should I remove this gradient for now, or keep it and replace it 
with `put` once I implement it?




----------------------------------------------------------------
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]


Reply via email to