bartekkuncer commented on code in PR #21047:
URL: https://github.com/apache/incubator-mxnet/pull/21047#discussion_r905908528


##########
src/operator/subgraph/dnnl/dnnl_fc.cc:
##########
@@ -63,11 +65,26 @@ class SgDNNLFCOp {
   }
 
  private:
+  enum { kDataMin = 0, kDataMax, kWeightMin, kWeightMax, kBiasMin, kBiasMax, 
kSumMin, kSumMax };
+
+  NDArray PrepareOutputWithSum(const NDArray& sum_input, const NDArray& 
output);
+  bool CheckInitializationConditions(const std::vector<NDArray>& inputs,
+                                     const std::vector<float>& minmaxvec,

Review Comment:
   Maybe min_max_vec to make it more readable?



##########
src/operator/subgraph/dnnl/dnnl_fc.cc:
##########
@@ -112,104 +128,54 @@ void SgDNNLFCOp::Forward(const OpContext& ctx,
   const int out_max_index = out_quantized ? index++ : 0;
   CHECK_EQ(out_data.size(), index);  // index is equal to total number of 
outputs
 
-  float data_min   = 0.0f;
-  float data_max   = 0.0f;
-  float weight_min = 0.0f;
-  float weight_max = 0.0f;
-  float bias_min   = 0.0f;
-  float bias_max   = 0.0f;
+  std::vector<float> minmaxvec(8);

Review Comment:
   Magic number.



##########
src/operator/subgraph/dnnl/dnnl_fc.cc:
##########
@@ -112,104 +128,54 @@ void SgDNNLFCOp::Forward(const OpContext& ctx,
   const int out_max_index = out_quantized ? index++ : 0;
   CHECK_EQ(out_data.size(), index);  // index is equal to total number of 
outputs
 
-  float data_min   = 0.0f;
-  float data_max   = 0.0f;
-  float weight_min = 0.0f;
-  float weight_max = 0.0f;
-  float bias_min   = 0.0f;
-  float bias_max   = 0.0f;
+  std::vector<float> minmaxvec(8);
+  minmaxvec[kDataMin]   = 0.0f;
+  minmaxvec[kDataMax]   = 0.0f;
+  minmaxvec[kWeightMin] = 0.0f;
+  minmaxvec[kWeightMax] = 0.0f;
+  minmaxvec[kBiasMin]   = 0.0f;
+  minmaxvec[kBiasMax]   = 0.0f;
 
-  const float sum_min   = idx.sum_min ? 
in_data[idx.sum_min].data().dptr<float>()[0] : 0.0;
-  const float sum_max   = idx.sum_max ? 
in_data[idx.sum_max].data().dptr<float>()[0] : 0.0;
+  minmaxvec[kSumMin]    = idx.sum_min ? 
in_data[idx.sum_min].data().dptr<float>()[0] : 0.0;

Review Comment:
   Maybe change to 0.0f to make it consistent?



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to