Template Function torch::python::add_module_bindings¶
Defined in File python.h
Function Documentation¶
-
template<typename ModuleType, typename ...Extra>
py::class_<ModuleType, Extra...> torch::python::add_module_bindings(py::class_<ModuleType, Extra...> module)¶ Adds method bindings for a pybind11
class_
that binds annn::Module
subclass.Say you have a pybind11 class object created with
py::class_<Net>(m, "Net")
. This function will add all the necessary.def()
calls to bind thenn::Module
base class’ methods, such astrain()
,eval()
etc. into Python.Users should prefer to use
bind_module
if possible.