sxjscience commented on a change in pull request #18313:
URL: https://github.com/apache/incubator-mxnet/pull/18313#discussion_r427072560



##########
File path: python/mxnet/numpy/multiarray.py
##########
@@ -282,6 +313,16 @@ def __array_ufunc__(self, ufunc, method, *inputs, 
**kwargs):  # pylint: disable=
                     _FALLBACK_ARRAY_UFUNC_WARNED_RECORD[onp_op] = True
                 out = onp_op(*new_inputs, **kwargs)
                 return _as_mx_np_array(out, ctx=inputs[0].ctx)
+            # ops with np mx_np
+            elif name in ufunc_list and isinstance(inputs[0], _np.ndarray):
+                # inplace
+                if 'out' in kwargs:
+                    new_inputs = [arg.asnumpy() if isinstance(arg, ndarray) 
else arg for arg in inputs]
+                    return onp_op(*new_inputs, **kwargs)
+                else:
+                    new_inputs = [_as_mx_np_array(arg, ctx=inputs[1].ctx)

Review comment:
       Ignore my previous comment. I mean to choose one element in the inputs 
that has a valid `ctx`.




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