From 272ccf2ac60193b99663e383d5388f7c06be5709 Mon Sep 17 00:00:00 2001 From: yuchaojie Date: Mon, 21 Dec 2020 14:17:01 +0800 Subject: [PATCH] details quant_config notes --- mindspore/nn/layer/quant.py | 40 ++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/mindspore/nn/layer/quant.py b/mindspore/nn/layer/quant.py index 870a911e6a..3e21ac564d 100644 --- a/mindspore/nn/layer/quant.py +++ b/mindspore/nn/layer/quant.py @@ -362,8 +362,9 @@ class Conv2dBnFoldQuantOneConv(Cell): var_init (Union[Tensor, str, Initializer, numbers.Number]): Initializer for the variance vector. Default: 'ones'. fake (bool): Whether Conv2dBnFoldQuant Cell adds FakeQuantWithMinMaxObserver. Default: True. - quant_config (QuantConfig): Configs the oberser types and quant configs of weight and activation. Default: - both set to default FakeQuantWithMinMaxObserver. + quant_config (QuantConfig): Configs the oberser types and quant settings of weight and activation. Can be + generated by compression.quant.create_quant_config method. + Default: both set to default FakeQuantWithMinMaxObserver. quant_dtype (QuantDtype): Specifies the FakeQuant datatype. Default: QuantDtype.INT8. Inputs: @@ -573,8 +574,9 @@ class Conv2dBnFoldQuant(Cell): var_init (Union[Tensor, str, Initializer, numbers.Number]): Initializer for the variance vector. Default: 'ones'. fake (bool): Whether Conv2dBnFoldQuant Cell adds FakeQuantWithMinMaxObserver. Default: True. - quant_config (QuantConfig): Configs the oberser types and quant configs of weight and activation. Default: - both set to default FakeQuantWithMinMaxObserver. + quant_config (QuantConfig): Configs the oberser types and quant settings of weight and activation. Can be + generated by compression.quant.create_quant_config method. + Default: both set to default FakeQuantWithMinMaxObserver. quant_dtype (QuantDtype): Specifies the FakeQuant datatype. Default: QuantDtype.INT8. freeze_bn (int): The quantization freeze BatchNormal op is according to the global step. Default: 100000. @@ -750,8 +752,9 @@ class Conv2dBnWithoutFoldQuant(Cell): weight_init (Union[Tensor, str, Initializer, numbers.Number]): Initializer for the convolution kernel. Default: 'normal'. bias_init (Union[Tensor, str, Initializer, numbers.Number]): Initializer for the bias vector. Default: 'zeros'. - quant_config (QuantConfig): Configs the oberser types and quant configs of weight and activation. Default: - both set to default FakeQuantWithMinMaxObserver. + quant_config (QuantConfig): Configs the oberser types and quant settings of weight and activation. Can be + generated by compression.quant.create_quant_config method. + Default: both set to default FakeQuantWithMinMaxObserver. quant_dtype (QuantDtype): Specifies the FakeQuant datatype. Default: QuantDtype.INT8. Inputs: @@ -862,8 +865,9 @@ class Conv2dQuant(Cell): weight_init (Union[Tensor, str, Initializer, numbers.Number]): Initializer for the convolution kernel. Default: 'normal'. bias_init (Union[Tensor, str, Initializer, numbers.Number]): Initializer for the bias vector. Default: 'zeros'. - quant_config (QuantConfig): Configs the oberser types and quant configs of weight and activation. Default: - both set to default FakeQuantWithMinMaxObserver. + quant_config (QuantConfig): Configs the oberser types and quant settings of weight and activation. Can be + generated by compression.quant.create_quant_config method. + Default: both set to default FakeQuantWithMinMaxObserver. quant_dtype (QuantDtype): Specifies the FakeQuant datatype. Default: QuantDtype.INT8. Inputs: @@ -967,8 +971,9 @@ class DenseQuant(Cell): has_bias (bool): Specifies whether the layer uses a bias vector. Default: True. activation (Union[str, Cell, Primitive]): The regularization function applied to the output of the layer, eg. 'relu'. Default: None. - quant_config (QuantConfig): Configs the oberser types and quant configs of weight and activation. Default: - both set to default FakeQuantWithMinMaxObserver. + quant_config (QuantConfig): Configs the oberser types and quant settings of weight and activation. Can be + generated by compression.quant.create_quant_config method. + Default: both set to default FakeQuantWithMinMaxObserver. quant_dtype (QuantDtype): Specifies the FakeQuant datatype. Default: QuantDtype.INT8. Inputs: @@ -1077,8 +1082,9 @@ class ActQuant(_QuantActivation): ema (bool): The exponential Moving Average algorithm updates min and max. Default: False. ema_decay (float): Exponential Moving Average algorithm parameter. Default: 0.999. fake_before (bool): Whether add fake quantized operation before activation. Default: False. - quant_config (QuantConfig): Configs the oberser types and quant configs of weight and activation. Default: - both set to default FakeQuantWithMinMaxObserver. + quant_config (QuantConfig): Configs the oberser types and quant settings of weight and activation. Can be + generated by compression.quant.create_quant_config method. + Default: both set to default FakeQuantWithMinMaxObserver. quant_dtype (QuantDtype): Specifies the FakeQuant datatype. Default: QuantDtype.INT8. Inputs: @@ -1141,8 +1147,9 @@ class TensorAddQuant(Cell): Args: ema_decay (float): Exponential Moving Average algorithm parameter. Default: 0.999. - quant_config (QuantConfig): Configs the oberser types and quant configs of weight and activation. Default: - both set to default FakeQuantWithMinMaxObserver. + quant_config (QuantConfig): Configs the oberser types and quant settings of weight and activation. Can be + generated by compression.quant.create_quant_config method. + Default: both set to default FakeQuantWithMinMaxObserver. quant_dtype (QuantDtype): Specifies the FakeQuant datatype. Default: QuantDtype.INT8. Inputs: @@ -1192,8 +1199,9 @@ class MulQuant(Cell): Args: ema_decay (float): Exponential Moving Average algorithm parameter. Default: 0.999. - quant_config (QuantConfig): Configs the oberser types and quant configs of weight and activation. Default: - both set to default FakeQuantWithMinMaxObserver. + quant_config (QuantConfig): Configs the oberser types and quant settings of weight and activation. Can be + generated by compression.quant.create_quant_config method. + Default: both set to default FakeQuantWithMinMaxObserver. quant_dtype (QuantDtype): Specifies the FakeQuant datatype. Default: QuantDtype.INT8. Inputs: