Skip to content

Commit

Permalink
Revert "optimize group_norm op backward (PaddlePaddle#39944)"
Browse files Browse the repository at this point in the history
This reverts commit 5720537.
  • Loading branch information
Zjq9409 authored Mar 17, 2022
1 parent 4db8cf2 commit c27dd14
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 299 deletions.
4 changes: 0 additions & 4 deletions paddle/fluid/operators/group_norm_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,9 @@ class GroupNormGradOp : public framework::OperatorWithKernel {

void InferShape(framework::InferShapeContext *ctx) const override {
// check input
OP_INOUT_CHECK(ctx->HasInput("X"), "Input", "X", "GroupNormGrad");
OP_INOUT_CHECK(ctx->HasInput("Y"), "Input", "Y", "GroupNormGrad");
OP_INOUT_CHECK(ctx->HasInput("Variance"), "Input", "Variance",
"GroupNormGrad");
OP_INOUT_CHECK(ctx->HasInput("Mean"), "Input", "Mean", "GroupNormGrad");
OP_INOUT_CHECK(ctx->HasInput(framework::GradVarName("Y")), "Input",
framework::GradVarName("Y"), "GroupNormGrad");

Expand Down Expand Up @@ -218,12 +216,10 @@ class GroupNormGradMaker : public framework::SingleGradOpMaker<T> {

void Apply(GradOpPtr<T> op) const override {
op->SetType("group_norm_grad");
op->SetInput("X", this->Input("X"));
op->SetInput("Scale", this->Input("Scale"));
op->SetInput("Bias", this->Input("Bias"));
op->SetInput(framework::GradVarName("Y"), this->OutputGrad("Y"));
op->SetInput("Y", this->Output("Y"));
op->SetInput("Mean", this->Output("Mean"));
op->SetInput("Variance", this->Output("Variance"));

op->SetOutput(framework::GradVarName("X"), this->InputGrad("X"));
Expand Down
Loading

0 comments on commit c27dd14

Please sign in to comment.