提交 2d2b6332 编写于 作者: L Luo Tao

add more comments in CMakelists.txt of operator

上级 5974c1b7
...@@ -37,8 +37,8 @@ class Registrar { ...@@ -37,8 +37,8 @@ class Registrar {
public: public:
// In our design, various kinds of classes, e.g., operators and kernels, // In our design, various kinds of classes, e.g., operators and kernels,
// have their corresponding registry and registrar. The action of // have their corresponding registry and registrar. The action of
// registration is in the constructor of a global registrar variable, which, // registration is in the constructor of a global registrar variable, which
// however, are not used in the code that calls package framework, and would // are not used in the code that calls package framework, and would
// be removed from the generated binary file by the linker. To avoid such // be removed from the generated binary file by the linker. To avoid such
// removal, we add Touch to all registrar classes and make USE_OP macros to // removal, we add Touch to all registrar classes and make USE_OP macros to
// call this method. So, as long as the callee code calls USE_OP, the global // call this method. So, as long as the callee code calls USE_OP, the global
......
...@@ -68,9 +68,10 @@ function(op_library TARGET) ...@@ -68,9 +68,10 @@ function(op_library TARGET)
endif() endif()
endforeach() endforeach()
# The registration of USE_OP, please refer to paddle/framework/op_registry.h.
# Note that it's enough to just adding one operator to pybind in a *_op.cc file.
# And for detail pybind information, please see generated paddle/pybind/pybind.h.
file(READ ${TARGET}.cc TARGET_CONTENT) file(READ ${TARGET}.cc TARGET_CONTENT)
# It's enough to just adding one operator to pybind.
# And for detail pybind information, please see paddle/pybind/pybind.h.
string(REGEX MATCH "REGISTER_OP\\(.*REGISTER_OP\\(" multi_register "${TARGET_CONTENT}") string(REGEX MATCH "REGISTER_OP\\(.*REGISTER_OP\\(" multi_register "${TARGET_CONTENT}")
string(REGEX MATCH "REGISTER_OP\\([a-z0-9_]*," one_register "${multi_register}") string(REGEX MATCH "REGISTER_OP\\([a-z0-9_]*," one_register "${multi_register}")
if (one_register STREQUAL "") if (one_register STREQUAL "")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册