yzhliu commented on a change in pull request #15938: Tvm broadcast backward
URL: https://github.com/apache/incubator-mxnet/pull/15938#discussion_r315579522
##########
File path: contrib/tvmop/basic/ufunc.py
##########
@@ -48,3 +50,71 @@ def vadd_gpu(dtype, ndim):
s[C].bind(bx, tvm.thread_axis("blockIdx.x"))
s[C].bind(tx, tvm.thread_axis("threadIdx.x"))
return s, [A, B, C]
+
+
+def assign_by_req(a, req):
+ b = tvm.placeholder(a.shape, name='assign_by_req_b', dtype=a.dtype)
+ if (req == "kAddTo"):
+ c = tvm.compute(a.shape, lambda *idx: a[idx] + b[idx])
+ else:
+ c = tvm.compute(a.shape, lambda *idx: a[idx])
+ return b, c
+
+
+def reduce_axes(X, axes, reducer):
Review comment:
can we add some comments to elaborate the idea? e.g., meaning of axes. also
can we move it to somewhere else so that other operators can reuse?
----------------------------------------------------------------
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]
With regards,
Apache Git Services