提交 37e0e7a9 编写于 作者: J joanna.wozna.intel 提交者: Tao Luo

QAT int8 accuracy little improvement (#21074)

test=develop
上级 8414575b
...@@ -514,11 +514,11 @@ class FakeQAT2MkldnnINT8PerfPass(object): ...@@ -514,11 +514,11 @@ class FakeQAT2MkldnnINT8PerfPass(object):
weights = np.array( weights = np.array(
self._load_param(self._scope, weight_var_name)) self._load_param(self._scope, weight_var_name))
scales = 1.0 / np.amax( scales = 1.0 / np.amax(
np.abs(weights.reshape(weights.shape[0], -1)), np.abs(weights.reshape(weights.shape[0], -1)).astype(
np.float64),
axis=axis) axis=axis)
lod_tensor = self._convert_scale2tensor( lod_tensor = self._convert_scale2tensor(scales)
scales.astype(np.float64))
use_unsigned_int = False use_unsigned_int = False
self._var_quant_scales[weight_var_name] = (use_unsigned_int, self._var_quant_scales[weight_var_name] = (use_unsigned_int,
lod_tensor) lod_tensor)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册