Browse Source

!10274 details quant_config notes

From: @yuchaojie
Reviewed-by: @liangchenghui,@linqingke
Signed-off-by: @liangchenghui
tags/v1.1.0
mindspore-ci-bot Gitee 5 years ago
parent
commit
5671b177f4
1 changed files with 24 additions and 16 deletions
  1. +24
    -16
      mindspore/nn/layer/quant.py

+ 24
- 16
mindspore/nn/layer/quant.py View File

@@ -362,8 +362,9 @@ class Conv2dBnFoldQuantOneConv(Cell):
var_init (Union[Tensor, str, Initializer, numbers.Number]): Initializer for the var_init (Union[Tensor, str, Initializer, numbers.Number]): Initializer for the
variance vector. Default: 'ones'. variance vector. Default: 'ones'.
fake (bool): Whether Conv2dBnFoldQuant Cell adds FakeQuantWithMinMaxObserver. Default: True. 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. quant_dtype (QuantDtype): Specifies the FakeQuant datatype. Default: QuantDtype.INT8.


Inputs: Inputs:
@@ -576,8 +577,9 @@ class Conv2dBnFoldQuant(Cell):
var_init (Union[Tensor, str, Initializer, numbers.Number]): Initializer for the var_init (Union[Tensor, str, Initializer, numbers.Number]): Initializer for the
variance vector. Default: 'ones'. variance vector. Default: 'ones'.
fake (bool): Whether Conv2dBnFoldQuant Cell adds FakeQuantWithMinMaxObserver. Default: True. 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. 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. freeze_bn (int): The quantization freeze BatchNormal op is according to the global step. Default: 100000.


@@ -753,8 +755,9 @@ class Conv2dBnWithoutFoldQuant(Cell):
weight_init (Union[Tensor, str, Initializer, numbers.Number]): Initializer for the convolution kernel. weight_init (Union[Tensor, str, Initializer, numbers.Number]): Initializer for the convolution kernel.
Default: 'normal'. Default: 'normal'.
bias_init (Union[Tensor, str, Initializer, numbers.Number]): Initializer for the bias vector. Default: 'zeros'. 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. quant_dtype (QuantDtype): Specifies the FakeQuant datatype. Default: QuantDtype.INT8.


Inputs: Inputs:
@@ -865,8 +868,9 @@ class Conv2dQuant(Cell):
weight_init (Union[Tensor, str, Initializer, numbers.Number]): Initializer for the convolution kernel. weight_init (Union[Tensor, str, Initializer, numbers.Number]): Initializer for the convolution kernel.
Default: 'normal'. Default: 'normal'.
bias_init (Union[Tensor, str, Initializer, numbers.Number]): Initializer for the bias vector. Default: 'zeros'. 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. quant_dtype (QuantDtype): Specifies the FakeQuant datatype. Default: QuantDtype.INT8.


Inputs: Inputs:
@@ -970,8 +974,9 @@ class DenseQuant(Cell):
has_bias (bool): Specifies whether the layer uses a bias vector. Default: True. 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, activation (Union[str, Cell, Primitive]): The regularization function applied to the output of the layer,
eg. 'relu'. Default: None. 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. quant_dtype (QuantDtype): Specifies the FakeQuant datatype. Default: QuantDtype.INT8.


Inputs: Inputs:
@@ -1080,8 +1085,9 @@ class ActQuant(_QuantActivation):
ema (bool): The exponential Moving Average algorithm updates min and max. Default: False. ema (bool): The exponential Moving Average algorithm updates min and max. Default: False.
ema_decay (float): Exponential Moving Average algorithm parameter. Default: 0.999. ema_decay (float): Exponential Moving Average algorithm parameter. Default: 0.999.
fake_before (bool): Whether add fake quantized operation before activation. Default: False. 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. quant_dtype (QuantDtype): Specifies the FakeQuant datatype. Default: QuantDtype.INT8.


Inputs: Inputs:
@@ -1144,8 +1150,9 @@ class TensorAddQuant(Cell):


Args: Args:
ema_decay (float): Exponential Moving Average algorithm parameter. Default: 0.999. 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. quant_dtype (QuantDtype): Specifies the FakeQuant datatype. Default: QuantDtype.INT8.


Inputs: Inputs:
@@ -1195,8 +1202,9 @@ class MulQuant(Cell):


Args: Args:
ema_decay (float): Exponential Moving Average algorithm parameter. Default: 0.999. 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. quant_dtype (QuantDtype): Specifies the FakeQuant datatype. Default: QuantDtype.INT8.


Inputs: Inputs:


Loading…
Cancel
Save