From 4b74178b54836d2415da184eb80ddce32b6ba25a Mon Sep 17 00:00:00 2001 From: Chen Weihang Date: Mon, 27 Jun 2022 10:45:03 +0800 Subject: [PATCH] Add get_op_names method for counting ops (#43831) * add get_op_names api * Update pybind.cc --- paddle/fluid/pybind/pybind.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/paddle/fluid/pybind/pybind.cc b/paddle/fluid/pybind/pybind.cc index b24c3546a39..a49e11aba68 100644 --- a/paddle/fluid/pybind/pybind.cc +++ b/paddle/fluid/pybind/pybind.cc @@ -1964,6 +1964,13 @@ All parameter, weight, gradient are variables in Paddle. } return ret_values; }); + m.def("get_all_op_names", []() { + std::vector op_names; + for (auto &iter : OpInfoMap::Instance().map()) { + op_names.emplace_back(iter.first); + } + return op_names; + }); m.def("get_op_attrs_default_value", [](py::bytes byte_name) -> paddle::framework::AttributeMap { std::string op_type = byte_name; -- GitLab