12 #ifndef MLPACK_BINDINGS_PYTHON_PRINT_CLASS_DEFN_HPP 13 #define MLPACK_BINDINGS_PYTHON_PRINT_CLASS_DEFN_HPP 28 const typename boost::disable_if
>::type* = 0, 40 const typename boost::enable_if
>::type* = 0) 51 const typename boost::disable_if
>::type* = 0, 56 std::string strippedType, printedType, defaultsType;
82 std::cout <<
"cdef class " << strippedType <<
"Type:" << std::endl;
83 std::cout <<
" cdef " << printedType <<
"* modelptr" << std::endl;
84 std::cout << std::endl;
85 std::cout <<
" def __cinit__(self):" << std::endl;
86 std::cout <<
" self.modelptr = new " << printedType <<
"()" << std::endl;
87 std::cout << std::endl;
88 std::cout <<
" def __dealloc__(self):" << std::endl;
89 std::cout <<
" del self.modelptr" << std::endl;
90 std::cout << std::endl;
91 std::cout <<
" def __getstate__(self):" << std::endl;
92 std::cout <<
" return SerializeOut(self.modelptr, \"" << printedType
93 <<
"\")" << std::endl;
94 std::cout << std::endl;
95 std::cout <<
" def __setstate__(self, state):" << std::endl;
96 std::cout <<
" SerializeIn(self.modelptr, state, \"" << printedType
97 <<
"\")" << std::endl;
98 std::cout << std::endl;
99 std::cout <<
" def __reduce_ex__(self, version):" << std::endl;
100 std::cout <<
" return (self.__class__, (), self.__getstate__())" 102 std::cout << std::endl;
118 PrintClassDefn
::type>(d);
Linear algebra utility functions, generally performed on matrices or vectors.
This structure holds all of the information about a single parameter, including its value (which is s...
void PrintClassDefn(util::ParamData &, const typename boost::disable_if< arma::is_arma_type< T >>::type *=0, const typename boost::disable_if< data::HasSerialize< T >>::type *=0)
Non-serializable models don't require any special definitions, so this prints nothing.
void StripType(const std::string &inputType, std::string &strippedType, std::string &printedType, std::string &defaultsType)
Given an input type like, e.g., "LogisticRegression<>", return three types that can be used in Python...
std::string cppType
The true name of the type, as it would be written in C++.