From 0b392187495a445ce9de267b97de554c7c45aa39 Mon Sep 17 00:00:00 2001 From: Double_V Date: Mon, 14 Oct 2019 19:52:14 +0800 Subject: [PATCH] memory optimizer for reshape op,test=develop (#20569) --- paddle/fluid/operators/reshape_op.cc | 5 ----- 1 file changed, 5 deletions(-) diff --git a/paddle/fluid/operators/reshape_op.cc b/paddle/fluid/operators/reshape_op.cc index 5daa937b01..5dd9dfba43 100644 --- a/paddle/fluid/operators/reshape_op.cc +++ b/paddle/fluid/operators/reshape_op.cc @@ -423,7 +423,6 @@ class Reshape2GradMaker : public framework::SingleGradOpDescMaker { std::unique_ptr Apply() const override { auto *grad_op = new framework::OpDesc(); grad_op->SetType("reshape2_grad"); - grad_op->SetInput("X", Input("X")); grad_op->SetInput("XShape", Output("XShape")); grad_op->SetInput("ShapeTensor", Input("ShapeTensor")); grad_op->SetInput(framework::GradVarName("Out"), OutputGrad("Out")); @@ -441,13 +440,10 @@ class Reshape2DoubleGradMaker : public framework::SingleGradOpDescMaker { auto *grad_op = new framework::OpDesc(); grad_op->SetType("reshape2_grad_grad"); - grad_op->SetInput("X", Input("X")); grad_op->SetInput("ShapeTensor", Input("ShapeTensor")); grad_op->SetInput("DOut", Input(framework::GradVarName("Out"))); grad_op->SetInput("DDX", OutputGrad(framework::GradVarName("X"))); - auto ddx = OutputGrad(framework::GradVarName("X")); - grad_op->SetOutput("DDOut", InputGrad(framework::GradVarName("Out"))); grad_op->SetAttrMap(Attrs()); return std::unique_ptr(grad_op); @@ -501,7 +497,6 @@ class Reshape2DoubleGradOp : public framework::OperatorWithKernel { : OperatorWithKernel(type, inputs, outputs, attrs) {} void InferShape(framework::InferShapeContext *ctx) const override { - PADDLE_ENFORCE_EQ(ctx->HasInput("X"), true, "Input(X) shouldn't be null."); PADDLE_ENFORCE_EQ(ctx->HasInput("DDX"), true, "Input(X@GRAD_GRAD) shouldn't be null."); -- GitLab