27 #ifndef LBANN_OBJECTIVE_FUNCTIONS_WEIGHT_REGULARIZATION_L2_WEIGHT_REGULARIZATION_HPP_INCLUDED 28 #define LBANN_OBJECTIVE_FUNCTIONS_WEIGHT_REGULARIZATION_L2_WEIGHT_REGULARIZATION_HPP_INCLUDED 34 #endif // LBANN_HAS_GPU 59 template <El::Device D>
60 using DMatType = El::Matrix<AccumulateDataType, D>;
75 template <
typename ArchiveT>
78 std::string
name()
const override {
return "L2 weight regularization"; }
109 gpu_lib::event_wrapper m_copy_event;
110 #endif // LBANN_HAS_GPU 118 template <El::Device Device>
125 #endif // LBANN_OBJECTIVE_FUNCTIONS_WEIGHT_REGULARIZATION_L2_WEIGHT_REGULARIZATION_HPP_INCLUDED DMatType< El::Device::CPU > CPUMatType
void serialize(ArchiveT &ar)
El::Matrix< AccumulateDataType, D > DMatType
DataType AccumulateDataType
l2_weight_regularization(EvalType scale_factor=1)
void compute_weight_regularization() override
void write_specific_proto(lbann_data::ObjectiveFunction &proto) const final
Add objective function data to prototext.
void start_evaluation() override
void differentiate() override
l2_weight_regularization * copy() const override
Apply L2 regularization to a set of weights.
EvalType finish_evaluation() override
Abstract base class for neural network models.
Al::request m_allreduce_req
std::map< El::Device, CPUMatType > m_contributions
std::string name() const override
static void accumulate_contribution(const DMatType< Device > &vals, DMatType< Device > &contribution)
void setup(model &m) override