27 #ifndef MXNET_CPP_OPTIMIZER_H_ 28 #define MXNET_CPP_OPTIMIZER_H_ 36 #include "dmlc/logging.h" 53 explicit Optimizer(
unsigned begin_num_update);
58 virtual std::string
GetType()
const = 0;
71 std::string value_str;
126 static Optimizer* Find(
const std::string& name);
127 static int __REGISTER__(
const std::string& name, OptimizerCreator creator);
129 static std::map<std::string, OptimizerCreator>& cmap();
134 #define MXNETCPP_REGISTER_OPTIMIZER(Name, OptimizerType) \ 135 static int __make_ ## OptimizerType ## _ ## Name ## __ = \ 136 OptimizerRegistry::__REGISTER__(#Name, [](){return new OptimizerType();}) 141 std::string
GetType()
const override;
146 std::map<int, NDArray*> states_;
154 std::string
GetType()
const override;
159 std::map<int, NDArray*> n_, g_, delta_;
167 std::string
GetType()
const override;
172 std::map<int, NDArray*> mean_;
173 std::map<int, NDArray*> var_;
180 std::string
GetType()
const override;
185 std::map<int, NDArray*> history_;
191 std::string
GetType()
const override;
196 std::map<int, NDArray*> acc_g_, acc_delta_;
202 #endif // MXNET_CPP_OPTIMIZER_H_ Definition: optimizer.h:138
OpMap instance holds a map of all the symbol creators so we can get symbol creators by name...
Definition: op_map.h:43
Definition: optimizer.h:164
unsigned UpdateCount_(int index)
namespace of mxnet
Definition: base.h:127
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:114
unsigned num_update_
Definition: optimizer.h:114
Optimizer interface.
Definition: optimizer.h:47
std::map< int, unsigned > count_
Definition: optimizer.h:113
Definition: optimizer.h:188
Definition: optimizer.h:177
NDArray interface.
Definition: ndarray.h:121
virtual void Update(int index, NDArray weight, NDArray grad)=0
Update a weight with gradient.
std::unique_ptr< LRScheduler > lrScheduler_
Definition: optimizer.h:119
Definition: optimizer.h:124
Definition: optimizer.h:151
std::map< std::string, std::string > params_
Definition: optimizer.h:109
virtual ~Optimizer()
destructor
void * AtomicSymbolCreator
handle to a function that takes param and creates symbol
Definition: c_api.h:69
const std::vector< const char * > GetParamValues_() const
Optimizer * SetParam(const std::string &name, const T &value)
set config parameters
Definition: optimizer.h:70
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:122
Optimizer * SetLRScheduler(std::unique_ptr< LRScheduler > lrScheduler)
Definition: optimizer.h:84