diff --git a/dnn/src/common/opr_delegate.h b/dnn/src/common/opr_delegate.h index d5e96b4b..58a0667c 100644 --- a/dnn/src/common/opr_delegate.h +++ b/dnn/src/common/opr_delegate.h @@ -24,7 +24,8 @@ namespace megdnn { * Usually used for calling other opr impls from some opr impl. You probably * want to use CpuOprDelegationStorage instead. */ -const std::shared_ptr& inplace_cpu_handle(int debug_level = 0); +MGE_WIN_DECLSPEC_FUC const std::shared_ptr& inplace_cpu_handle( + int debug_level = 0); /*! * \brief storage for oprs on inplace CPU handle diff --git a/imperative/python/src/module.cpp b/imperative/python/src/module.cpp index ef0e3135..26c57093 100644 --- a/imperative/python/src/module.cpp +++ b/imperative/python/src/module.cpp @@ -14,6 +14,7 @@ #define DO_IMPORT_ARRAY #include "./helper.h" #include "./numpy_dtypes.h" +#include "megdnn/handle.h" #include "./common.h" #include "./graph_rt.h" @@ -30,6 +31,10 @@ using namespace mgb::imperative::python; #define MODULE_NAME imperative_rt #endif +namespace megdnn { +extern const std::shared_ptr& inplace_cpu_handle(int debug_level = 0); +} + PYBIND11_MODULE(MODULE_NAME, m) { // initialize numpy if ([]() { @@ -39,6 +44,8 @@ PYBIND11_MODULE(MODULE_NAME, m) { throw py::error_already_set(); } + megdnn::inplace_cpu_handle(); + py::module::import("sys").attr("modules")[m.attr("__name__")] = m; m.attr("__package__") = m.attr("__name__");