regularizer.cc 698 字节
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
#include "regularizer.h"

namespace paddle {
namespace optimizer {

template <class T>
Regularizer<T>* Regularizer<T>::create(const std::string& config) {
  paddle::OptimizerConfig config;
  Regularizer<T>* r;
  if (config.regularizer_type() == paddle::OptimizerConfig_RegularizerType_L1) {
    r = new L1Regularizer<T>(config);
  } else if (config.regularizer_type() ==
             paddle::OptimizerConfig_RegularizerType_L2) {
    r = new L2Regularizer<T>(config);
    break;
  }
  return r;
}

template class L1Regularizer<float>;
template class L1Regularizer<double>;
22 23
template class L2Regularizer<float>;
template class L2Regularizer<double>;
24 25 26

}  // namespace optimizer
}  // namespace paddle