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();
133 #define MXNETCPP_REGISTER_OPTIMIZER(Name, OptimizerType)\ 134 OptimizerRegistry::__REGISTER__(#Name, [](){return new OptimizerType();}) 139 std::string
GetType()
const override;
144 std::map<int, NDArray*> states_;
152 std::string
GetType()
const override;
157 std::map<int, NDArray*> states_;
166 std::string
GetType()
const override;
171 std::map<int, NDArray*> n_, g_, delta_;
179 std::string
GetType()
const override;
184 std::map<int, NDArray*> mean_;
185 std::map<int, NDArray*> var_;
192 std::string
GetType()
const override;
197 std::map<int, NDArray*> history_;
203 std::string
GetType()
const override;
208 std::map<int, NDArray*> acc_g_, acc_delta_;
214 #endif // MXNET_CPP_OPTIMIZER_H_ Definition: optimizer.h:136
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:176
unsigned UpdateCount_(int index)
namespace of mxnet
Definition: base.h:118
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
Definition: optimizer.h:149
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:200
Definition: optimizer.h:189
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:163
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:71
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