MCPcopy Create free account
hub / github.com/apache/singa / ApplyRegularizerConstraint

Method ApplyRegularizerConstraint

src/model/optimizer/optimizer.cc:63–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61 */
62}
63void Optimizer::ApplyRegularizerConstraint(int epoch, const string& name,
64 const Tensor& value, Tensor& grad, int step) {
65 // TODO(wangwei) need to consider the order of constraint and regularizer
66 if (regularizers_.find(name) != regularizers_.end()) {
67 regularizers_.at(name)->Apply(epoch, value, grad, step);
68 } else if (regularizer_ != nullptr) {
69 regularizer_->Apply(epoch, value, grad, step);
70 }
71 if (constraints_.find(name) != constraints_.end())
72 constraints_.at(name)->Apply(epoch, value, grad, step);
73 else if (constraint_ != nullptr)
74 constraint_->Apply(epoch, value, grad, step);
75}
76
77
78void Optimizer::Apply(int epoch, const string& name, Tensor& grad,

Callers

nothing calls this directly

Calls 2

endMethod · 0.45
ApplyMethod · 0.45

Tested by

no test coverage detected