26 #ifndef MXNET_CPP_OPTIMIZER_H_ 27 #define MXNET_CPP_OPTIMIZER_H_ 35 #include "dmlc/logging.h" 52 explicit Optimizer(
unsigned begin_num_update);
57 virtual std::string
GetType()
const = 0;
70 std::string value_str;
125 static Optimizer* Find(
const std::string& name);
126 static int __REGISTER__(
const std::string& name, OptimizerCreator creator);
128 static std::map<std::string, OptimizerCreator>& cmap();
133 #define MXNETCPP_REGISTER_OPTIMIZER(Name, OptimizerType) \ 134 static int __make_ ## OptimizerType ## _ ## Name ## __ = \ 135 OptimizerRegistry::__REGISTER__(#Name, [](){return new OptimizerType();}) 140 std::string
GetType()
const override;
145 std::map<int, NDArray*> states_;
153 std::string
GetType()
const override;
158 std::map<int, NDArray*> n_, g_, delta_;
166 std::string
GetType()
const override;
171 std::map<int, NDArray*> mean_;
172 std::map<int, NDArray*> var_;
179 std::string
GetType()
const override;
184 std::map<int, NDArray*> history_;
190 std::string
GetType()
const override;
195 std::map<int, NDArray*> acc_g_, acc_delta_;
201 #endif // MXNET_CPP_OPTIMIZER_H_ Definition: optimizer.h:137
OpMap instance holds a map of all the symbol creators so we can get symbol creators by name...
Definition: op_map.h:42
Definition: optimizer.h:163
unsigned UpdateCount_(int index)
namespace of mxnet
Definition: base.h:126
Optimizer(unsigned begin_num_update)
constructor
const std::vector< const char * > GetParamKeys_() const
virtual std::string GetType() const =0
get optimizer type
Scheduling learning rate.
unsigned begin_num_update_
Definition: optimizer.h:113
unsigned num_update_
Definition: optimizer.h:113
Optimizer interface.
Definition: optimizer.h:46
std::map< int, unsigned > count_
Definition: optimizer.h:112
Definition: optimizer.h:187
Definition: optimizer.h:176
NDArray interface.
Definition: ndarray.h:120
virtual void Update(int index, NDArray weight, NDArray grad)=0
Update a weight with gradient.
std::unique_ptr< LRScheduler > lrScheduler_
Definition: optimizer.h:118
Definition: optimizer.h:123
Definition: optimizer.h:150
std::map< std::string, std::string > params_
Definition: optimizer.h:108
virtual ~Optimizer()
destructor
void * AtomicSymbolCreator
handle to a function that takes param and creates symbol
Definition: c_api.h:68
const std::vector< const char * > GetParamValues_() const
Optimizer * SetParam(const std::string &name, const T &value)
set config parameters
Definition: optimizer.h:69
virtual void CreateState_(int index, NDArray weight)
std::string Serialize() const
Serialize the optimizer parameters to a string.
std::function< Optimizer *()> OptimizerCreator
Definition: optimizer.h:121
Optimizer * SetLRScheduler(std::unique_ptr< LRScheduler > lrScheduler)
Definition: optimizer.h:83