未验证 提交 29ef7cc9 编写于 作者: W wanghuancoder 提交者: GitHub

add run interface for standalone executor, test=develop (#35761)

上级 02b0be08
...@@ -1992,6 +1992,26 @@ All parameter, weight, gradient are variables in Paddle. ...@@ -1992,6 +1992,26 @@ All parameter, weight, gradient are variables in Paddle.
feed_tensors.push_back(t); feed_tensors.push_back(t);
} }
paddle::framework::FetchList ret;
{
pybind11::gil_scoped_release release;
ret = self.Run(feed_names, feed_tensors, fetch_names);
}
return py::cast(std::move(ret));
})
.def("run",
[](StandaloneExecutor &self,
const std::unordered_map<std::string, framework::Tensor>
&input_dict,
std::vector<std::string> fetch_names) {
std::vector<framework::Tensor> feed_tensors;
std::vector<std::string> feed_names;
for (auto &item : input_dict) {
feed_names.push_back(item.first);
feed_tensors.push_back(item.second);
}
paddle::framework::FetchList ret; paddle::framework::FetchList ret;
{ {
pybind11::gil_scoped_release release; pybind11::gil_scoped_release release;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册