You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/08/24 16:36:08 UTC

[GitHub] larroy commented on a change in pull request #12308: [MKLDNN] Enable convolution fusion.

larroy commented on a change in pull request #12308: [MKLDNN] Enable convolution fusion.
URL: https://github.com/apache/incubator-mxnet/pull/12308#discussion_r212685502
 
 

 ##########
 File path: src/operator/nn/mkldnn/mkldnn_convolution-inl.h
 ##########
 @@ -35,19 +35,48 @@
 namespace mxnet {
 namespace op {
 
+struct ConvFusionParam : public dmlc::Parameter<ConvFusionParam> {
+  // When adding more members into this clss, please double check GetHash()
+  // won't overflow.
+  bool with_bn;
+  bool with_relu;
+  bool with_sum;
+  bool with_postsum_relu;
+  DMLC_DECLARE_PARAMETER(ConvFusionParam) {
+    DMLC_DECLARE_FIELD(with_bn).set_default(false)
+    .describe("Add post batchnorm.");
+    DMLC_DECLARE_FIELD(with_relu).set_default(false)
+    .describe("Add post relu");
+    DMLC_DECLARE_FIELD(with_sum).set_default(false)
+    .describe("Add post sum");
+    DMLC_DECLARE_FIELD(with_postsum_relu).set_default(false)
+    .describe("Add post relu after sum");
+  }
+  const int GetHash() const {
+    int hash = 0;
+    hash = hash * 2 + this->with_bn ? 1 : 0;
 
 Review comment:
   why not std::hash?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services