@@ -77,6 +77,8 @@ def parse_args():
77
77
78
78
parser .add_argument ('-wi' , '--conv_algo' , dest = 'conv_algo' , action = "store_true" , default = False ,
79
79
help = 'to choose the convolution algorithm' )
80
+ parser .add_argument ('-1st' , '--enable_1st_conv_layer' , dest = 'enable_1st_conv_layer' , action = "store_true" , default = False ,
81
+ help = 'enable 1st conv layer' )
80
82
if len (sys .argv ) == 1 :
81
83
parser .print_help ()
82
84
sys .exit (1 )
@@ -117,14 +119,14 @@ def parse_args():
117
119
if args .quantized_prototxt == None :
118
120
test_net (net , imdb , max_per_image = args .max_per_image , vis = args .vis )
119
121
else :
120
- (blobs , params , top_blobs_map , bottom_blobs_map , conv_top_blob_layer_map , conv_bottom_blob_layer_map , winograd_bottoms , winograd_convolutions ) = sample_net (args .prototxt , net , imdb , args .sample_iters , args .quant_mode )
122
+ (blobs , params , top_blobs_map , bottom_blobs_map , conv_top_blob_layer_map , conv_bottom_blob_layer_map , winograd_bottoms , winograd_convolutions ) = sample_net (args .prototxt , net , imdb , args .sample_iters , args .quant_mode , args . enable_1st_conv_layer )
121
123
122
124
(inputs_max , outputs_max , inputs_min ) = sampling .calibrate_activations (blobs , conv_top_blob_layer_map , conv_bottom_blob_layer_map , winograd_bottoms , args .calibration_algos , "SINGLE" , args .conv_algo )
123
125
params_max = sampling .calibrate_parameters (params , winograd_convolutions , "DIRECT" , args .quant_mode .upper (), args .conv_algo )
124
- calibrator .generate_sample_impl (args .prototxt , args .quantized_prototxt , inputs_max , outputs_max , inputs_min , params_max , False )
126
+ calibrator .generate_sample_impl (args .prototxt , args .quantized_prototxt , inputs_max , outputs_max , inputs_min , params_max , args . enable_1st_conv_layer )
125
127
compiled_net_str = caffe .compile_net (args .prototxt , caffe .TEST , "MKLDNN" )
126
128
raw_net_basename = os .path .basename (args .prototxt )
127
129
compile_net_path = "./compiled_" + raw_net_basename
128
130
with open (compile_net_path , "w" ) as f :
129
131
f .write (compiled_net_str )
130
- calibrator .transform_convolutions (args .quantized_prototxt , compile_net_path , top_blobs_map , bottom_blobs_map , args .unsigned_range , args .concat_use_fp32 , args .unify_concat_scales , args .conv_algo , False )
132
+ calibrator .transform_convolutions (args .quantized_prototxt , compile_net_path , top_blobs_map , bottom_blobs_map , args .unsigned_range , args .concat_use_fp32 , args .unify_concat_scales , args .conv_algo , args . enable_1st_conv_layer )
0 commit comments