|
LBANN
0.103.0
LivermoreBigArtificialNeuralNetworkToolkit
|
Apply L2 regularization to a set of weights. More...
#include <l2.hpp>
Public Types | |
| using | AccumulateDataType = DataType |
| using | OptimizerType = data_type_optimizer< DataType > |
| using | WeightsType = data_type_weights< DataType > |
| template<El::Device D> | |
| using | DMatType = El::Matrix< AccumulateDataType, D > |
| using | CPUMatType = DMatType< El::Device::CPU > |
Public Member Functions | |
| l2_weight_regularization (EvalType scale_factor=1) | |
| l2_weight_regularization * | copy () const override |
| template<typename ArchiveT > | |
| void | serialize (ArchiveT &ar) |
| std::string | name () const override |
| void | setup (model &m) override |
| void | start_evaluation () override |
| EvalType | finish_evaluation () override |
| void | differentiate () override |
| void | compute_weight_regularization () override |
Public Member Functions inherited from lbann::objective_function_term | |
| objective_function_term (EvalType scale_factor=EvalType(1)) | |
| objective_function_term (const objective_function_term &other)=default | |
| objective_function_term & | operator= (const objective_function_term &other)=default |
| virtual | ~objective_function_term ()=default |
| template<class Archive > | |
| void | serialize (Archive &ar) |
| std::vector< ViewingLayerPtr > | get_layer_pointers () const |
| void | set_layer_pointers (std::vector< ViewingLayerPtr > layers) |
| std::vector< ViewingWeightsPtr > | get_weights_pointers () const |
| void | set_weights_pointers (std::vector< ViewingWeightsPtr > w) |
Private Member Functions | |
| void | write_specific_proto (lbann_data::ObjectiveFunction &proto) const final |
| Add objective function data to prototext. More... | |
Static Private Member Functions | |
| template<El::Device Device> | |
| static void | accumulate_contribution (const DMatType< Device > &vals, DMatType< Device > &contribution) |
Private Attributes | |
| std::map< El::Device, CPUMatType > | m_contributions |
| Al::request | m_allreduce_req |
Additional Inherited Members | |
Protected Member Functions inherited from lbann::objective_function_term | |
| lbann_comm & | get_comm () |
Protected Attributes inherited from lbann::objective_function_term | |
| EvalType | m_scale_factor |
| std::vector< ViewingLayerPtr > | m_layers |
| std::vector< ViewingWeightsPtr > | m_weights |
Apply L2 regularization to a set of weights.
Given a weights tensor
,
Note the
scaling factor.
| using lbann::l2_weight_regularization::AccumulateDataType = DataType |
| using lbann::l2_weight_regularization::CPUMatType = DMatType<El::Device::CPU> |
| using lbann::l2_weight_regularization::DMatType = El::Matrix<AccumulateDataType, D> |
| using lbann::l2_weight_regularization::OptimizerType = data_type_optimizer<DataType> |
| using lbann::l2_weight_regularization::WeightsType = data_type_weights<DataType> |
| lbann::l2_weight_regularization::l2_weight_regularization | ( | EvalType | scale_factor = 1 | ) |
| scale_factor | The objective function term is |
|
staticprivate |
Add the sum of squares of vals to contribution.
| vals | The values to accumulate |
| contribution | matrix. Used as an accumulation variable. |
|
overridevirtual |
Compute the gradient w.r.t. the weights.
Implements lbann::objective_function_term.
|
inlineoverridevirtual |
Copy function.
Implements lbann::objective_function_term.
Definition at line 69 of file l2.hpp.
|
inlineoverridevirtual |
Compute the gradient w.r.t. the activations.
L2 regularization is independent of forward prop output, so nothing needs to be done here.
Implements lbann::objective_function_term.
Definition at line 90 of file l2.hpp.
|
overridevirtual |
Complete evaluation of the objective function term.
Implements lbann::objective_function_term.
|
inlineoverridevirtual |
Get the name of the objective function term.
Implements lbann::objective_function_term.
Definition at line 78 of file l2.hpp.
| void lbann::l2_weight_regularization::serialize | ( | ArchiveT & | ar | ) |
Archive for checkpoint and restart
|
overridevirtual |
Setup objective function term.
Reimplemented from lbann::objective_function_term.
|
overridevirtual |
Start evaluation of the objective function term. This should include the scaling factor. The result is not available until finish_evaluation has been called.
Implements lbann::objective_function_term.
|
finalprivatevirtual |
Add objective function data to prototext.
Implements lbann::objective_function_term.
|
private |
|
private |