MCPcopy Create free account
hub / github.com/DeepGraphLearning/graphvite / pyMomentum

Class pyMomentum

include/bind.h:871–900  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

869};
870
871class pyMomentum : public py::class_<graphvite::Momentum, graphvite::Optimizer> {
872public:
873 typedef graphvite::Momentum Momentum;
874 typedef py::class_<Momentum, graphvite::Optimizer> Base;
875 using Base::def_readonly;
876 using Base::def;
877
878 template<class... Args>
879 pyMomentum(py::handle scope, const char *name, const Args &...args) :
880 Base(scope, name, args...) {
881 attr("__doc__") = "Momentum(lr=1e-4, weight_decay=0, momentum=0.999, schedule='linear')"
882 R"(
883 Momentum optimizer.
884
885 Parameters:
886 lr (float, optional): initial learning rate
887 weight_decay (float, optional): weight decay (L2 regularization)
888 momentum (float, optional): momentum coefficient
889 schedule (str or callable, optional): learning rate schedule
890 )";
891
892 // data members
893 def_readonly("momentum", &Momentum::momentum);
894
895 // member functions
896 def(py::init<float, float, float, graphvite::LRSchedule>(), py::no_gil(),
897 py::arg("lr") = 1e-4, py::arg("weight_decay") = 0, py::arg("momentum") = 0.999,
898 py::arg("schedule") = "linear");
899 }
900};
901
902class pyAdaGrad : public py::class_<graphvite::AdaGrad, graphvite::Optimizer> {
903public:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected