@@ -154,7 +154,6 @@ def _get_quant_zp_const(quantization_dict, as_scalar = False):
154154def test_qnn_conv2d_mobilenetv1_layer (layer , interpreter ):
155155 in_dtype = "int8"
156156 schedule_name , dtype , padding , strides = _get_layer_attributes (layer )
157-
158157 """Load the input, kernel, bias, and generated output from each layer when it was run by the
159158 TensorFlow TFLite interpreter. The tensor values are quantized (though note that biases_tensor
160159 is an int32), while the quantization data is not. Note the zero points are zero everywhere
@@ -163,10 +162,13 @@ def test_qnn_conv2d_mobilenetv1_layer(layer, interpreter):
163162 def lookup (detail ):
164163 return interpreter .get_tensor (detail ["index" ]), detail ["quantization_parameters" ]
165164 inputs_tensor , inputs_quant = lookup (_get_main_path_tensor_details (tensor_details , layer ))
165+ print (inputs_tensor .shape )
166166 kernel_tensor , kernel_quant = lookup (_get_kernel_details (tensor_details , layer ))
167+ print (kernel_tensor .shape )
167168 biases_tensor , biases_quant = lookup (_get_bias_details (tensor_details , layer ))
169+ print (biases_tensor .shape )
168170 output_tensor , output_quant = lookup (_get_main_path_tensor_details (tensor_details , layer + 1 ))
169-
171+ out_channel_multiplier , kernel_h , kernel_w , in_channels = kernel_tensor . shape
170172
171173 # Reshape tensors to match the layouts we will see after legalization
172174 if layer % 2 == 0 : # Regular conv2d
@@ -187,15 +189,15 @@ def lookup(detail):
187189 kernel_zero_point = _get_quant_zp_const (kernel_quant ),
188190 input_scale = _get_quant_scale_const (inputs_quant , as_scalar = True ),
189191 kernel_scale = _get_quant_scale_const (kernel_quant ),
190- kernel_size = (3 , 3 ),
192+ kernel_size = (kernel_h , kernel_w ),
191193 data_layout = new_inputs_layout ,
192194 kernel_layout = new_kernel_layout ,
193195
194196 dilation = (1 , 1 ),
195197 strides = strides ,
196198 padding = padding ,
197- groups = (1 if layer % 2 == 0 else 3 ),
198- channels = 8 ,
199+ groups = (1 if layer % 2 == 0 else in_channels ),
200+ channels = ( out_channel_multiplier if layer % 2 == 0 else in_channels ) ,
199201 out_dtype = "int32" ,
200202 )
201203
@@ -219,7 +221,7 @@ def lookup(detail):
219221 test_model = AOTTestModel (
220222 module = tvm .IRModule .from_expr (test_function ),
221223 inputs = {"input" : inputs_ndarr },
222- outputs = {"Identity " : output_ndarr },
224+ outputs = {"output " : output_ndarr },
223225 )
224226
225227 compile_and_run (
@@ -229,7 +231,7 @@ def lookup(detail):
229231 use_unpacked_api = True ,
230232 target_opts = {
231233 "-keys" : "arm_cpu" ,
232- "-mcpu" : "cortex-m4 " ,
234+ "-mcpu" : "cortex-m7 " ,
233235 },
234236 schedule_name = schedule_name ,
235237 verbose = True ,
0 commit comments