| 931 | }; |
| 932 | |
| 933 | class pyRMSprop : public py::class_<graphvite::RMSprop, graphvite::Optimizer> { |
| 934 | public: |
| 935 | typedef graphvite::RMSprop RMSprop; |
| 936 | typedef py::class_<RMSprop, graphvite::Optimizer> Base; |
| 937 | using Base::def_readonly; |
| 938 | using Base::def; |
| 939 | |
| 940 | template<class... Args> |
| 941 | pyRMSprop(py::handle scope, const char *name, const Args &...args) : |
| 942 | Base(scope, name, args...) { |
| 943 | attr("__doc__") = "RMSprop(lr=1e-4, weight_decay=0, alpha=0.999, epsilon=1e-8, schedule='linear')" |
| 944 | R"( |
| 945 | RMSprop optimizer. |
| 946 | |
| 947 | Parameters: |
| 948 | lr (float, optional): initial learning rate |
| 949 | weight_decay (float, optional): weight decay (L2 regularization) |
| 950 | alpha (float, optional): coefficient for moving average of squared gradient |
| 951 | epsilon (float, optional): smooth term for numerical stability |
| 952 | schedule (str or callable, optional): learning rate schedule |
| 953 | )"; |
| 954 | |
| 955 | // data members |
| 956 | def_readonly("alpha", &RMSprop::alpha); |
| 957 | def_readonly("epsilon", &RMSprop::epsilon); |
| 958 | |
| 959 | // member functions |
| 960 | def(py::init<float, float, float, float, graphvite::LRSchedule>(), py::no_gil(), |
| 961 | py::arg("lr") = 1e-4, py::arg("weight_decay") = 0, py::arg("alpha") = 0.999, py::arg("epsilon") = 1e-8, |
| 962 | py::arg("schedule") = "linear"); |
| 963 | } |
| 964 | }; |
| 965 | |
| 966 | class pyAdam : public py::class_<graphvite::Adam, graphvite::Optimizer> { |
| 967 | public: |
nothing calls this directly
no outgoing calls
no test coverage detected