marcoabreu commented on a change in pull request #10433: [MXNET-290] MKLDNN
support for model quantization
URL: https://github.com/apache/incubator-mxnet/pull/10433#discussion_r193374954
##########
File path: tests/python/quantization/test_quantization.py
##########
@@ -409,11 +441,19 @@ def test_quantize_sym_with_calib():
sym = get_fp32_sym()
offline_params = [name for name in sym.list_arguments()
if not name.startswith('data') and not
name.endswith('label')]
- qsym = mx.contrib.quant._quantize_symbol(sym,
offline_params=offline_params)
- requantize_op_names = ['requantize_conv', 'requantize_fc']
- th_dict = {'conv_output': (np.random.uniform(low=100.0, high=200.0),
np.random.uniform(low=100.0, high=200.0)),
- 'fc_output': (np.random.uniform(low=100.0, high=200.0),
np.random.uniform(low=100.0, high=200.0))}
- op_name_to_th_name = {'requantize_conv': 'conv_output', 'requantize_fc':
'fc_output'}
+ if is_test_for_mkldnn():
+ dtype = 'uint8'
+ requantize_op_names = ['requantize_conv']
+ th_dict = {'conv_output': (np.random.uniform(low=100.0, high=200.0),
np.random.uniform(low=100.0, high=200.0))}
+ op_name_to_th_name = {'requantize_conv': 'conv_output'}
+ else:
+ dtype = 'int8'
+ requantize_op_names = ['requantize_conv', 'requantize_fc']
+ th_dict = {'conv_output': (np.random.uniform(low=100.0, high=200.0),
np.random.uniform(low=100.0, high=200.0)),
+ 'fc_output': (np.random.uniform(low=100.0, high=200.0),
np.random.uniform(low=100.0, high=200.0))}
+ op_name_to_th_name = {'requantize_conv': 'conv_output',
'requantize_fc': 'fc_output'}
Review comment:
The expected output should not depend on the backend. Also, the fully
connected output is missing above
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services