MCPcopy Create free account
hub / github.com/LBANN/lbann / AddToGrad

Class AddToGrad

src/objective_functions/weight_regularization/l2.cpp:192–212  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

190// use-case. Given the line count, this was clearly the way to go... :/
191namespace {
192struct AddToGrad
193{
194 AddToGrad(optimizer& opt, EvalType scale_factor)
195 : opt_{&opt}, scale_{scale_factor}
196 {}
197 void DispatchError(El::BaseDistMatrix const&)
198 {
199 LBANN_ERROR("Unable to dispatch!");
200 }
201 void DeductionError(El::BaseDistMatrix const&)
202 {
203 LBANN_ERROR("Unable to deduce type!");
204 }
205 template <typename T>
206 void operator()(El::AbstractDistMatrix<T> const& contrib)
207 {
208 opt_->add_to_gradient(contrib, El::To<T>(scale_));
209 }
210 optimizer* opt_;
211 EvalType scale_;
212}; // struct AddToGrad
213
214using ValidDataTypes = h2::meta::TL<
215#ifdef LBANN_HAS_GPU_FP16

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected