Browse Source

!15960 quant_mode raise type error

From: @zhang__sss
Reviewed-by: @zhoufeng54,@zh_qh
Signed-off-by: @zh_qh
pull/15960/MERGE
mindspore-ci-bot Gitee 4 years ago
parent
commit
8bb3d7b961
1 changed files with 3 additions and 1 deletions
  1. +3
    -1
      mindspore/train/serialization.py

+ 3
- 1
mindspore/train/serialization.py View File

@@ -815,9 +815,11 @@ def quant_mode_manage(func):
Inherit the quant_mode in old version.
"""
def warpper(network, *inputs, file_format, **kwargs):
if not kwargs.get('quant_mode', None):
if 'quant_mode' not in kwargs:
return network
quant_mode = kwargs['quant_mode']
if not isinstance(quant_mode, str):
raise TypeError("The type of quant_mode should be str, but got {}.".format(type(quant_mode)))
if quant_mode in ('AUTO', 'MANUAL'):
kwargs['quant_mode'] = 'QUANT'
return func(network, *inputs, file_format=file_format, **kwargs)


Loading…
Cancel
Save