| 900 | }; |
| 901 | |
| 902 | class pyAdaGrad : public py::class_<graphvite::AdaGrad, graphvite::Optimizer> { |
| 903 | public: |
| 904 | typedef graphvite::AdaGrad AdaGrad; |
| 905 | typedef py::class_<AdaGrad, graphvite::Optimizer> Base; |
| 906 | using Base::def_readonly; |
| 907 | using Base::def; |
| 908 | |
| 909 | template<class... Args> |
| 910 | pyAdaGrad(py::handle scope, const char *name, const Args &...args) : |
| 911 | Base(scope, name, args...) { |
| 912 | attr("__doc__") = "AdaGrad(lr=1e-4, weight_decay=0, epsilon=1e-10, schedule='linear')" |
| 913 | R"( |
| 914 | AdaGrad optimizer. |
| 915 | |
| 916 | Parameters: |
| 917 | lr (float, optional): initial learning rate |
| 918 | weight_decay (float, optional): weight decay (L2 regularization) |
| 919 | epsilon (float, optional): smooth term for numerical stability |
| 920 | schedule (str or callable, optional): learning rate schedule |
| 921 | )"; |
| 922 | |
| 923 | // data members |
| 924 | def_readonly("epsilon", &AdaGrad::epsilon); |
| 925 | |
| 926 | // member functions |
| 927 | def(py::init<float, float, float, graphvite::LRSchedule>(), py::no_gil(), |
| 928 | py::arg("lr") = 1e-4, py::arg("weight_decay") = 0, py::arg("epsilon") = 1e-10, |
| 929 | py::arg("schedule") = "linear"); |
| 930 | } |
| 931 | }; |
| 932 | |
| 933 | class pyRMSprop : public py::class_<graphvite::RMSprop, graphvite::Optimizer> { |
| 934 | public: |
nothing calls this directly
no outgoing calls
no test coverage detected