haojin2 commented on a change in pull request #16720: [Numpy] Implement numpy 
operator 'average'
URL: https://github.com/apache/incubator-mxnet/pull/16720#discussion_r341960828
 
 

 ##########
 File path: src/operator/numpy/np_broadcast_reduce_op_value.cc
 ##########
 @@ -249,6 +250,76 @@ inline bool IsIntType(const int dtype) {
           dtype == mshadow::kInt64);
 }
 
+inline bool NumpyWeightedAverageType(const nnvm::NodeAttrs& attrs,
+                                     std::vector<int> *in_attrs,
+                                     std::vector<int> *out_attrs) {
+  const NumpyWeightedAverageParam &param = 
nnvm::get<NumpyWeightedAverageParam>(attrs.parsed);
+  CHECK_EQ(in_attrs->size(), (param.weighted ? 2U : 1U));
+  CHECK_EQ(out_attrs->size(), 2U);
+
+  TYPE_ASSIGN_CHECK(*in_attrs, 0, out_attrs->at(0));
+  TYPE_ASSIGN_CHECK(*out_attrs, 0, in_attrs->at(0));
+  if (param.weighted) {
+    TYPE_ASSIGN_CHECK(*in_attrs, 1, in_attrs->at(0));
+  }
+  TYPE_ASSIGN_CHECK(*out_attrs, 1, in_attrs->at(0));
+
+  return in_attrs->at(0) != -1 && out_attrs->at(0) != -1 &&
+      (!param.weighted || (in_attrs->at(1) != -1)) &&
 
 Review comment:
   Alignment:
   ```c++
     return in_attrs->at(0) != -1 && out_attrs->at(0) != -1 &&
            (!param.weighted || (in_attrs->at(1) != -1)) &&
            out_attrs->at(1) != -1;
   ```

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