Skip to content

Commit

Permalink
move check args,kwargs before forward execute
Browse files Browse the repository at this point in the history
  • Loading branch information
MingMingShangTian committed Dec 15, 2021
1 parent 41307c6 commit b9c22a4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions paddle/fluid/imperative/py_layer_fwd.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,6 @@ py::object PyLayerApply(const platform::Place& place, const py::handle& cls,
auto context = bk_function();
auto forward = cls.attr("forward");

auto result_forward = forward(context, *args, **kwargs);
std::shared_ptr<operators::PyLayerContext> py_layer_ctx =
std::make_shared<operators::PyLayerContext>(context.ptr());
// make inputs to varbase
std::vector<std::shared_ptr<imperative::VarBase>> input_vars;
// process args,`input_vars` only collect `imperative::VarBase`
Expand Down Expand Up @@ -166,6 +163,10 @@ py::object PyLayerApply(const platform::Place& place, const py::handle& cls,
}
}
}

std::shared_ptr<operators::PyLayerContext> py_layer_ctx =
std::make_shared<operators::PyLayerContext>(context.ptr());
auto result_forward = forward(context, *args, **kwargs);
NameVarBaseMap ins = {{"X", input_vars}};

std::vector<std::shared_ptr<imperative::VarBase>> output_vars;
Expand Down

1 comment on commit b9c22a4

@paddle-bot-old
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Congratulation! Your pull request passed all required CI. You could ask reviewer(s) to approve and merge. 🎉

Please sign in to comment.