Thanks. I tried your suggestion, but I got the following compiling error. I used a function based on the one in your example, and the C++ apply worked fine.
Here’s my code for binding the methods:
namespace py = pybind11;
PYBIND11_MODULE(actv, m) {
	py::class_<CPTanh>(m, "CPTanh")//line 25
		.def_static("forward", &CPTanh::forward)
		.def_static("backward", &CPTanh::backward)
		.def_static("apply",&CPTanh::apply); //line 28

}

Here’s the error:
actv.cpp(29): error C2672: 'pybind11::class_<CPTanh>::def_static': no matching overloaded function foun
d
actv.cpp(26): error C2783: 'pybind11::class_<CPTanh> &pybind11::class_<CPTanh>::def_static(const char *
,Func &&,const Extra &...)': could not deduce template argument for 'Func'

It seems that apply can’t be bind in the common way, do u have any idea about this(I’m quite new in C++)?