You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by zh...@apache.org on 2021/10/31 02:47:14 UTC

[incubator-mxnet] branch master updated: [master] Add aliases for subgraph operators to be compatible with old models (#20679)

This is an automated email from the ASF dual-hosted git repository.

zhasheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git


The following commit(s) were added to refs/heads/master by this push:
     new 3dffdc1  [master] Add aliases for subgraph operators to be compatible with old models (#20679)
3dffdc1 is described below

commit 3dffdc1e639f1bc3f74a3cbc389ab4416e7793c8
Author: bartekkuncer <ba...@intel.com>
AuthorDate: Sun Oct 31 03:45:06 2021 +0100

    [master] Add aliases for subgraph operators to be compatible with old models (#20679)
    
    * Add aliases
    
    * Apply clang format
    
    * Remove unnecessary _sg_mkldnn_*
    
    * Fix review
    
    * Simplify comparison
---
 src/operator/subgraph/dnnl/dnnl_conv.cc                  | 1 +
 src/operator/subgraph/dnnl/dnnl_fc.cc                    | 1 +
 src/operator/subgraph/dnnl/dnnl_post_quantize_property.h | 2 +-
 src/operator/subgraph/dnnl/dnnl_transformer.cc           | 2 ++
 4 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/operator/subgraph/dnnl/dnnl_conv.cc b/src/operator/subgraph/dnnl/dnnl_conv.cc
index 8702430..f85ece3 100644
--- a/src/operator/subgraph/dnnl/dnnl_conv.cc
+++ b/src/operator/subgraph/dnnl/dnnl_conv.cc
@@ -731,6 +731,7 @@ bool SgDNNLAvoidConvQuantizeInput(const NodeAttrs& attrs,
 }
 
 NNVM_REGISTER_OP(_sg_onednn_conv)
+    .add_alias("_sg_mkldnn_conv")
     .describe(R"code(_sg_onednn_conv)code" ADD_FILELINE)
     .set_num_inputs(SgDNNLConvNumInputs)
     .set_num_outputs([](const NodeAttrs& attrs) {
diff --git a/src/operator/subgraph/dnnl/dnnl_fc.cc b/src/operator/subgraph/dnnl/dnnl_fc.cc
index 24910e7..c07b8f7 100644
--- a/src/operator/subgraph/dnnl/dnnl_fc.cc
+++ b/src/operator/subgraph/dnnl/dnnl_fc.cc
@@ -652,6 +652,7 @@ static bool SgDNNLAvoidFCQuantizeInput(const NodeAttrs& attrs,
 }
 
 NNVM_REGISTER_OP(_sg_onednn_fully_connected)
+    .add_alias("_sg_mkldnn_fully_connected")
     .describe(R"code(_sg_onednn_fully_connected)code" ADD_FILELINE)
     .set_num_inputs([](const NodeAttrs& attrs) {
       auto const& full_param = nnvm::get<DNNLFCFullParam>(attrs.parsed);
diff --git a/src/operator/subgraph/dnnl/dnnl_post_quantize_property.h b/src/operator/subgraph/dnnl/dnnl_post_quantize_property.h
index 6da4386..662b792 100644
--- a/src/operator/subgraph/dnnl/dnnl_post_quantize_property.h
+++ b/src/operator/subgraph/dnnl/dnnl_post_quantize_property.h
@@ -56,7 +56,7 @@ class SgDNNLPostQuantizeSelector : public SubgraphSelector {
 
   bool Select(const nnvm::Node& n) override {
     if (n.op() && support_requantize_fusion_op_name.count(n.op()->name)) {
-      if (n.op()->name == "_sg_onednn_conv") {
+      if (n.op() == Op::Get("_sg_onednn_conv")) {
         auto const& param = nnvm::get<DNNLConvFusionParam>(n.attrs.parsed);
         if (param.full_conv_param.dnnl_param.quantized) {
           status = kStart;
diff --git a/src/operator/subgraph/dnnl/dnnl_transformer.cc b/src/operator/subgraph/dnnl/dnnl_transformer.cc
index 965aff4..e71761a 100644
--- a/src/operator/subgraph/dnnl/dnnl_transformer.cc
+++ b/src/operator/subgraph/dnnl/dnnl_transformer.cc
@@ -306,6 +306,7 @@ nnvm::ObjectPtr SgDNNLSelfAttQKQuantizedOp(const NodeAttrs& attrs) {
 }
 
 NNVM_REGISTER_OP(_sg_onednn_selfatt_qk)
+    .add_alias("_sg_mkldnn_selfatt_qk")
     .describe(R"code(_sg_onednn_selfatt_qk)code" ADD_FILELINE)
     .set_num_inputs([](const NodeAttrs& attrs) {
       auto const& param = nnvm::get<DNNLSelfAttParam>(attrs.parsed);
@@ -700,6 +701,7 @@ void DNNLSelfAttValAttOp::Forward(const OpContext& ctx,
 }
 
 NNVM_REGISTER_OP(_sg_onednn_selfatt_valatt)
+    .add_alias("_sg_mkldnn_selfatt_valatt")
     .describe(R"code(_sg_onednn_selfatt_valatt)code" ADD_FILELINE)
     .set_num_inputs([](const NodeAttrs& attrs) {
       auto const& param = nnvm::get<DNNLSelfAttParam>(attrs.parsed);