From f6bffd4e1ff506319fa1a3338038d61d3f653181 Mon Sep 17 00:00:00 2001 From: zchen0211 Date: Fri, 11 Aug 2017 15:40:23 -0700 Subject: [PATCH] gather_op modified --- paddle/operators/gather_op.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/paddle/operators/gather_op.cc b/paddle/operators/gather_op.cc index 5a4f889f3d8..05ba52ce064 100644 --- a/paddle/operators/gather_op.cc +++ b/paddle/operators/gather_op.cc @@ -51,8 +51,10 @@ Y = X[Index] class GatherGradOp : public framework::OperatorWithKernel { protected: void InferShape(const framework::InferShapeContext &ctx) const override { - ctx.Output("X" + framework::kGradVarSuffix) - ->Resize(ctx.Input("X")->dims()); + auto X_grad = ctx.Output(framework::GradVarName("X")); + auto X = ctx.Input("X"); + + X_grad->Resize(X->dims()); } }; -- GitLab