From f9823c53ca2a9e7c6f730772108b2ff9ae7a9ea8 Mon Sep 17 00:00:00 2001 From: chenfei Date: Mon, 14 Sep 2020 15:34:55 +0800 Subject: [PATCH] add has_bias for convert to quant network --- mindspore/train/quant/quant.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mindspore/train/quant/quant.py b/mindspore/train/quant/quant.py index c112f1e711..c4c224c30c 100644 --- a/mindspore/train/quant/quant.py +++ b/mindspore/train/quant/quant.py @@ -187,7 +187,9 @@ class ConvertToQuantNetwork: num_bits=self.weight_bits, fake=True, symmetric=self.weight_symmetric, - narrow_range=self.weight_range) + narrow_range=self.weight_range, + has_bias=conv_inner.has_bias, + bias_init=conv_inner.bias_init) # change original network BatchNormal OP parameters to quant network conv_inner.gamma = subcell.batchnorm.gamma conv_inner.beta = subcell.batchnorm.beta @@ -212,7 +214,9 @@ class ConvertToQuantNetwork: per_channel=self.weight_channel, num_bits=self.weight_bits, symmetric=self.weight_symmetric, - narrow_range=self.weight_range) + narrow_range=self.weight_range, + has_bias=conv_inner.has_bias, + bias_init=conv_inner.bias_init) # change original network BatchNormal OP parameters to quant network conv_inner.batchnorm.gamma = subcell.batchnorm.gamma conv_inner.batchnorm.beta = subcell.batchnorm.beta