yzhliu commented on a change in pull request #18642:
URL: https://github.com/apache/incubator-mxnet/pull/18642#discussion_r448755291



##########
File path: src/api/operator/numpy/np_elemwise_broadcast_logic_op.cc
##########
@@ -44,31 +44,65 @@ MXNET_REGISTER_API("_npi.not_equal")
   UFuncHelper(args, ret, op, op_scalar, nullptr);
 });
 
+void set_UFuncHelper(runtime::MXNetArgs args, runtime::MXNetRetValue* ret,
+                     const nnvm::Op* op, const nnvm::Op* op_scalar,
+                     const nnvm::Op* op_rscalar) {
+  int result = 0;
+  if (args[1].type_code() == kNDArrayHandle) {
+    result++;
+    result <<= 1;
+  }
+  if (args[0].type_code() == kNDArrayHandle) {
+    result++;
+  }
+
+  switch (result) {

Review comment:
       this is a clever trick, yet I suggest to explicitly use `if (..&&..) ... 
else if (.. && ..) ... else` to make it more clear and readable.

##########
File path: src/api/operator/numpy/np_elemwise_broadcast_logic_op.cc
##########
@@ -44,31 +44,65 @@ MXNET_REGISTER_API("_npi.not_equal")
   UFuncHelper(args, ret, op, op_scalar, nullptr);
 });
 
+void set_UFuncHelper(runtime::MXNetArgs args, runtime::MXNetRetValue* ret,

Review comment:
       ```suggestion
   void SetUFuncHelper(runtime::MXNetArgs args, runtime::MXNetRetValue* ret,
   ```




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to