コード例 #1
0
void OptimizerWithRegularizerEveryNumBatches::doTraversal(
    const VectorPtr vecs[], const ParameterConfig& config) const {
  int32_t base =
      std::max(baseTimer_, (timer_ + 1 - config.num_batches_regularization()));
  regularizer_->update(
      vecs, config, optimizer_->getLearningRate(), base, timer_ + 1);
}
コード例 #2
0
void OptimizerWithRegularizerEveryNumBatches::catchUpWith(
    const VectorPtr vecs[],
    const ParameterConfig& config,
    size_t sparseId) const {
  int32_t base = timer_ - timer_ % config.num_batches_regularization();
  regularizer_->update(vecs,
                       config,
                       optimizer_->getLearningRate(),
                       std::max(base, baseTimer_),
                       timer_);
}