Skip to content

Commit 85b2f05

Browse files
authored
register ModifyAttr for instance_norm, test=op_version (#30065)
* register instance norm, test=op_version
1 parent ddcff25 commit 85b2f05

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

paddle/fluid/inference/analysis/ir_passes/tensorrt_subgraph_pass.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ REGISTER_PASS_CAPABILITY(tensorrt_subgraph_pass)
392392
.EQ("shuffle_channel", 0)
393393
.EQ("swish", 0)
394394
.EQ("split", 0)
395-
.EQ("instance_norm", 0)
395+
.LE("instance_norm", 1)
396396
.EQ("gelu", 0)
397397
.EQ("layer_norm", 0)
398398
.EQ("scale", 0)

paddle/fluid/operators/instance_norm_op.cc

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ limitations under the License. */
1717
#include <string>
1818
#include <unordered_map>
1919
#include "paddle/fluid/framework/data_layout.h"
20+
#include "paddle/fluid/framework/op_version_registry.h"
2021
#include "paddle/fluid/operators/math/math_function.h"
2122

2223
namespace paddle {
@@ -701,3 +702,20 @@ REGISTER_OP_CPU_KERNEL(
701702
float>,
702703
ops::InstanceNormDoubleGradKernel<paddle::platform::CPUDeviceContext,
703704
double>);
705+
706+
REGISTER_OP_VERSION(instance_norm)
707+
.AddCheckpoint(
708+
R"ROC(
709+
Change dispensable of attribute from False to True in instance_norm.
710+
)ROC",
711+
paddle::framework::compatible::OpVersionDesc()
712+
.ModifyAttr(
713+
"Bias",
714+
"The arg 'dispensable' of Input 'Bias' is changed: from "
715+
"'False' to 'True'.",
716+
true)
717+
.ModifyAttr(
718+
"Scale",
719+
"The arg 'dispensable' of Input 'Scale' is changed: from "
720+
"'False' to 'True'.",
721+
true));

0 commit comments

Comments
 (0)