hzfan commented on a change in pull request #17779: [Numpy] FFI Invocation for 
Unary Ops
URL: https://github.com/apache/incubator-mxnet/pull/17779#discussion_r389303557
 
 

 ##########
 File path: src/api/operator/ufunc_helper.cc
 ##########
 @@ -107,4 +107,22 @@ void UFuncHelper(runtime::MXNetArgs args,
   }
 }
 
+void UFuncHelper(runtime::MXNetArgs args,
+                 runtime::MXNetRetValue* ret,
+                 const nnvm::Op* op) {
+  using namespace runtime;
+  nnvm::NodeAttrs attrs;
+  attrs.op = op;
+  NDArray* inputs[] = {args[0].operator NDArray*()};
+  NDArray* out = args[1].operator NDArray*();
+  NDArray** outputs = out == nullptr ? nullptr : &out;
+  int num_outputs = out != nullptr;
+  auto ndoutputs = Invoke(op, &attrs, 1, inputs, &num_outputs, outputs);
 
 Review comment:
   `1` seems like a magic number. Use `int num_inputs = 1` here?

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


With regards,
Apache Git Services

Reply via email to