From 8364688c303c09e7284d9e63f395860ffccf52a6 Mon Sep 17 00:00:00 2001 From: minqiyang Date: Mon, 18 Mar 2019 20:12:18 +0800 Subject: [PATCH] Fix py_func_op's problem --- paddle/fluid/operators/controlflow/get_places_op.cc | 6 +++--- paddle/fluid/operators/py_func_op.cc | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/paddle/fluid/operators/controlflow/get_places_op.cc b/paddle/fluid/operators/controlflow/get_places_op.cc index 0258739d6d..fa77f97419 100644 --- a/paddle/fluid/operators/controlflow/get_places_op.cc +++ b/paddle/fluid/operators/controlflow/get_places_op.cc @@ -93,9 +93,9 @@ execution. class GetPlacesInferVarType : public framework::VarTypeInference { public: - void operator()(framework::InferVarTypeContext &ctx) const override { - for (auto &o_name : ctx.Output("Out")) { - ctx.SetType(o_name, framework::proto::VarType::PLACE_LIST); + void operator()(framework::InferVarTypeContext *ctx) const override { + for (auto &o_name : ctx->Output("Out")) { + ctx->SetType(o_name, framework::proto::VarType::PLACE_LIST); } } }; diff --git a/paddle/fluid/operators/py_func_op.cc b/paddle/fluid/operators/py_func_op.cc index 67202c7f9d..5300e80747 100644 --- a/paddle/fluid/operators/py_func_op.cc +++ b/paddle/fluid/operators/py_func_op.cc @@ -99,7 +99,7 @@ class PyFuncOpVarTypeInference : public framework::VarTypeInference { void operator()(framework::InferVarTypeContext *ctx) const override { bool has_out = (ctx->HasOutput("Out") && !ctx->Output("Out").empty()); - bool has_in = (ctx->HasInput("X") && !ctx->Input("Out").empty()); + bool has_in = (ctx->HasInput("X") && !ctx->Input("X").empty()); /** * X or Out can be empty, so that py_func can be more flexible -- GitLab