.. _program_listing_file_src_optimizers_exponential_smoothing.h: Program Listing for File exponential_smoothing.h ================================================ |exhale_lsh| :ref:`Return to documentation for file ` (``src/optimizers/exponential_smoothing.h``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp #pragma once #include "common/definitions.h" #include "functional/functional.h" #include "tensors/tensor_operators.h" #include "common/options.h" namespace marian { class ExponentialSmoothing { public: ExponentialSmoothing(Ptr options) { mvDecayBy_ = options->get("exponential-smoothing", 0); refBatchTrgWords_ = options->get("mini-batch-words-ref", 0); // adjust as if our MB size (in target labels) was this value mvAvg_ = (mvDecayBy_ > 0); } protected: void updateAvgParams(Tensor paramsAvg, Tensor params, size_t batches, size_t actualBatchTrgWords); bool mvAvg_{false}; float mvDecayBy_{1e-4f}; // decay prior model by this factor size_t refBatchTrgWords_{0}; // mvDecayBy_ is specified for this batch size (in target words) (0 means not specified) }; } // namespace marian