Class MixPrecisionCfg

#include <cfg.h>

MixPrecisionCfgMindSpore Lite训练混合精度配置类。

构造函数

  MixPrecisionCfg() {
    dynamic_loss_scale_ = false;
    loss_scale_ = 128.0f;
    num_of_not_nan_iter_th_ = 1000;
  }
  MixPrecisionCfg(const MixPrecisionCfg &rhs) {
    this->dynamic_loss_scale_ = rhs.dynamic_loss_scale_;
    this->loss_scale_ = rhs.loss_scale_;
    this->keep_batchnorm_fp32_ = rhs.keep_batchnorm_fp32_;
    this->num_of_not_nan_iter_th_ = rhs.num_of_not_nan_iter_th_;
  }
  • 参数

    • rhs: 混合精度配置。tr

析构函数

~MixPrecisionCfg() = default

公有成员变量

bool dynamic_loss_scale_ = false

混合精度训练中是否启用动态损失比例。

float loss_scale_

初始损失比例。

uint32_t num_of_not_nan_iter_th_

动态损失阈值。

bool is_raw_mix_precision_

原始模型是否是原生混合精度模型。

bool keep_batchnorm_fp32_ = true

原型模型是否保持BatchNorm算子为Fp32格式。