From 85b2f05ab0e3b6fd68b8e6b3a13980c7ed1137bc Mon Sep 17 00:00:00 2001 From: ceci3 Date: Mon, 4 Jan 2021 13:20:00 +0800 Subject: [PATCH] register ModifyAttr for instance_norm, test=op_version (#30065) * register instance norm, test=op_version --- .../ir_passes/tensorrt_subgraph_pass.cc | 2 +- paddle/fluid/operators/instance_norm_op.cc | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/paddle/fluid/inference/analysis/ir_passes/tensorrt_subgraph_pass.cc b/paddle/fluid/inference/analysis/ir_passes/tensorrt_subgraph_pass.cc index 4bd804dfca4..c84bba33be1 100644 --- a/paddle/fluid/inference/analysis/ir_passes/tensorrt_subgraph_pass.cc +++ b/paddle/fluid/inference/analysis/ir_passes/tensorrt_subgraph_pass.cc @@ -392,7 +392,7 @@ REGISTER_PASS_CAPABILITY(tensorrt_subgraph_pass) .EQ("shuffle_channel", 0) .EQ("swish", 0) .EQ("split", 0) - .EQ("instance_norm", 0) + .LE("instance_norm", 1) .EQ("gelu", 0) .EQ("layer_norm", 0) .EQ("scale", 0) diff --git a/paddle/fluid/operators/instance_norm_op.cc b/paddle/fluid/operators/instance_norm_op.cc index 1018adcd930..28643ac1c0d 100644 --- a/paddle/fluid/operators/instance_norm_op.cc +++ b/paddle/fluid/operators/instance_norm_op.cc @@ -17,6 +17,7 @@ limitations under the License. */ #include #include #include "paddle/fluid/framework/data_layout.h" +#include "paddle/fluid/framework/op_version_registry.h" #include "paddle/fluid/operators/math/math_function.h" namespace paddle { @@ -701,3 +702,20 @@ REGISTER_OP_CPU_KERNEL( float>, ops::InstanceNormDoubleGradKernel); + +REGISTER_OP_VERSION(instance_norm) + .AddCheckpoint( + R"ROC( + Change dispensable of attribute from False to True in instance_norm. + )ROC", + paddle::framework::compatible::OpVersionDesc() + .ModifyAttr( + "Bias", + "The arg 'dispensable' of Input 'Bias' is changed: from " + "'False' to 'True'.", + true) + .ModifyAttr( + "Scale", + "The arg 'dispensable' of Input 'Scale' is changed: from " + "'False' to 'True'.", + true)); -- GitLab