From 94f03dc24581ee038d84c53209ff2a67e808d407 Mon Sep 17 00:00:00 2001 From: Chen Weihang Date: Sat, 5 Mar 2022 13:25:25 +0800 Subject: [PATCH] support add infershape for no grad op (#40182) --- paddle/fluid/framework/op_registry.h | 4 ++-- paddle/fluid/operators/empty_op.cc | 9 +++------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/paddle/fluid/framework/op_registry.h b/paddle/fluid/framework/op_registry.h index c45bf32d8b..eb40a49b40 100644 --- a/paddle/fluid/framework/op_registry.h +++ b/paddle/fluid/framework/op_registry.h @@ -286,8 +286,8 @@ struct OpKernelRegistrarFunctorEx, \ paddle::framework::EmptyGradOpMaker) diff --git a/paddle/fluid/operators/empty_op.cc b/paddle/fluid/operators/empty_op.cc index 6baa504562..96fa3282d0 100644 --- a/paddle/fluid/operators/empty_op.cc +++ b/paddle/fluid/operators/empty_op.cc @@ -90,9 +90,6 @@ namespace plat = paddle::platform; DELCARE_INFER_SHAPE_FUNCTOR(empty, EmptyInferShapeFunctor, PT_INFER_META(phi::CreateInferMeta)); - -REGISTER_OPERATOR( - empty, ops::EmptyOp, ops::EmptyOpMaker, ops::EmptyOpVarTypeInference, - paddle::framework::EmptyGradOpMaker, - paddle::framework::EmptyGradOpMaker, - EmptyInferShapeFunctor); +REGISTER_OP_WITHOUT_GRADIENT(empty, ops::EmptyOp, ops::EmptyOpMaker, + ops::EmptyOpVarTypeInference, + EmptyInferShapeFunctor); -- GitLab