ptrendx commented on a change in pull request #17265: Add bfloat16 
floating-point format support based on AMP 
URL: https://github.com/apache/incubator-mxnet/pull/17265#discussion_r365371650
 
 

 ##########
 File path: example/quantization/imagenet_inference.py
 ##########
 @@ -99,7 +100,34 @@ def score(sym, arg_params, aux_params, data, devs, 
label_name, max_num_examples,
             logger.info(m.get())
 
 
-def benchmark_score(symbol_file, ctx, batch_size, num_batches, 
data_layer_type, logger=None):
+def low_precison_convert(model_name, low_precision, sym, arg_params, 
aux_params, excluded_sym_names=[]):
+    if low_precision == 'bfloat16':
+        if model_name.find('imagenet1k-resnet-152') != -1:
+            excluded_sym_names += ['conv0']
+        elif model_name.find('imagenet1k-inception-bn') != -1:
+            excluded_sym_names += ['conv_1']
+        elif model_name.find('resnet') != -1 and model_name.find('v1') != -1:
+            excluded_sym_names += ['resnetv10_conv0_fwd']
+        elif model_name.find('resnet') != -1 and model_name.find('v2') != -1:
+            excluded_sym_names += ['resnetv20_conv0_fwd']
+        elif model_name.find('vgg') != -1:
+            excluded_sym_names += ['vgg0_conv0_fwd']
+        elif model_name.find('squeezenet1') != -1:
+            excluded_sym_names += ['squeezenet0_conv0_fwd']
+        elif model_name.find('mobilenet') != -1 and model_name.find('v2') == 
-1:
+            excluded_sym_names += ['mobilenet0_conv0_fwd']
+        elif model_name.find('mobilenet') != -1 and model_name.find('v2') != 
-1:
+            excluded_sym_names += ['mobilenetv20_conv0_fwd']
+        elif model_name.find('inceptionv3') != -1:
+            excluded_sym_names += ['inception30_conv0_fwd']
 
 Review comment:
   Why? Is there an accuracy issue without those exclusions?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to