haojin2 commented on a change in pull request #17254: [numpy] change unary 
infer type
URL: https://github.com/apache/incubator-mxnet/pull/17254#discussion_r366778630
 
 

 ##########
 File path: src/operator/tensor/elemwise_binary_op.h
 ##########
 @@ -525,6 +525,67 @@ class ElemwiseBinaryOp : public OpBase {
     });
   }
 
+  template<typename xpu, typename OP>
+  static void MixedUnaryBackwardUseInCompute(const nnvm::NodeAttrs &attrs,
+                                             const OpContext &ctx,
+                                             const std::vector<TBlob> &inputs,
+                                             const std::vector<OpReqType> &req,
+                                             const std::vector<TBlob> 
&outputs) {
+    using namespace mxnet_op;
+    if (req[0] == kNullOp) return;
+    Stream<xpu> *s = ctx.get_stream<xpu>();
+    CHECK_EQ(inputs.size(), 2U);
+    CHECK_EQ(outputs.size(), 1U);
+    if (!mxnet::common::is_float(inputs[1].type_flag_)) {
+      LOG(FATAL) << "Operator " << attrs.op->name <<
+                    " does not support type " << inputs[1].type_flag_;
+    }
+    if (outputs[0].type_flag_ == mshadow::kBool) {
+      LOG(FATAL) << "Operator " << attrs.op->name << " does not support 
boolean type";
 
 Review comment:
   Same for the error message here since `outputs[0].type_flag_` is technically 
same as `inputs[1].type_flag_`

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