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

Class pyLRSchedule

include/bind.h:757–798  ·  view source on GitHub ↗

Optimizer interface

Source from the content-addressed store, hash-verified

755
756// Optimizer interface
757class pyLRSchedule : public py::class_<graphvite::LRSchedule> {
758public:
759 typedef graphvite::LRSchedule LRSchedule;
760 typedef py::class_<LRSchedule> Base;
761 using Base::def;
762 using Base::def_readonly;
763
764 template<class... Args>
765 pyLRSchedule(py::handle scope, const char *name, const Args &...args) :
766 Base(scope, name, args...) {
767 attr("__doc__") = "LRSchedule(*args, **kwargs)"
768 R"(
769 Learning Rate Schedule.
770
771 This class has 2 constructors
772
773 .. function:: LRSchedule(type='constant')
774 .. function:: LRSchedule(schedule_function)
775
776 Parameters:
777 type (str, optional): 'constant' or 'linear'
778 schedule_function (callable): function that returns a multiplicative factor,
779 given batch id and total number of batches
780 )";
781
782 // data members
783 def_readonly("type", &LRSchedule::type);
784 def_readonly("schedule_function", &LRSchedule::schedule_function);
785
786 // member functions
787 def(py::init<std::string>(), py::no_gil(),
788 py::arg("type") = "constant");
789
790 def(py::init<LRSchedule::ScheduleFunction>(), py::no_gil(),
791 py::arg("schedule_function"));
792
793 py::implicitly_convertible<std::string, graphvite::LRSchedule>();
794 py::implicitly_convertible<LRSchedule::ScheduleFunction, graphvite::LRSchedule>();
795
796 def("__repr__", &LRSchedule::info, py::no_gil());
797 }
798};
799
800class pyOptimizer : public py::class_<graphvite::Optimizer> {
801public:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected