code: def test_qnn_conv2d_mobilenetv1_layer(
      interpreter, layer, output_layout
  ):
      """Checks microTVM output against TFLite for one MobileNetV1 layer.
  
      Loads the input, kernel, bias, expected output, and quantization parameters from the specified
      layer in a TFLite Interpreter. That information is used to construct a Relay Function with the
      same structure. The Function is run using microTVM and AOTTestModel, and we verify microTVM's
      output is the same as the TFLite ground truth.
  
      This function only cross-checks the first 27 layers in MobileNetV1, which are regular and
      depthwise 2D convolutions (this function only works for 2D convolutions). We do not test the
      average pool, dense, or softmax layers at the end of the model.
  
      Note that we disable the QNN Legalization pass. This allows TVM to use its QNN compute
      definitions, fuse the three operations together, and perform other optimizations.
  
      Parameters
      ----------
      interpreter: tensorflow.lite.python.interpreter.Interpreter
          A TensorFlow Lite interpreter for a MobileNetV1 model, where invoke() has already been
          called and experimental_preserve_all_tensors=True. Should be passed as a Pytest fixture.
  
      layer: int
          The index of the layer to check against TensorFlow's ground truth values.
  
      output_layout: str
          The output_layout for microTVM to use. Does not have to match the TensorFlow layout.
      """
      dtype = "int16"
  
      tensor, kernel, bias, output = _load_tflite_layer(
          interpreter, layer
      )
  
      (
          padding,
          strides,
          is_depthwise,
      ) = _get_mobilenet_v1_layer_attributes(layer)
      if is_depthwise:
          data_layout, kernel_layout = "NCHW", "OIHW"
      else:
          data_layout, kernel_layout = "NHWC", "OHWI"
  
      test_model = _make_aot_model(
          (tensor, kernel, bias, output),
          (dtype, padding, strides),
          (data_layout, kernel_layout, output_layout),
          is_depthwise=is_depthwise,
      )
  
      def schedule_fn(_sch):
          return True
  
      with tvm.transform.PassContext(
          opt_level=3,
          config={
              "tir.disable_vectorize": True,
              "relay.backend.use_meta_schedule": True,
              "relay.backend.tir_converter": "allow_extern",
          },
          disabled_pass=["qnn.Legalize"],
      ), meta_schedule.database.ScheduleFnDatabase(schedule_fn):
          executor_factory = tvm.relay.build(
              test_model.module,
              _make_target(),
              executor=_make_executor(),
              runtime=Runtime("crt"),
              params=test_model.params,
              mod_name=test_model.name,
          )
          compiled = AOTCompiledTestModel(
              model=test_model, executor_factory=executor_factory
          )
  
      run_and_check(
          models=[compiled],
          runner=AOT_CORSTONE300_RUNNER,
          interface_api="c",
          workspace_byte_alignment=8,
          constant_byte_alignment=8,
      )
  
imports: import numpy
  from PIL import Image
  import pytest
  import tvm
  import tvm.testing
  from tvm import meta_schedule, relay
  from tvm.testing.aot import AOTTestModel, run_and_check, AOTCompiledTestModel
  from tvm.relay.backend import Executor, Runtime
  from tvm.micro.testing.aot_test_utils import AOT_CORSTONE300_RUNNER
  from tvm.contrib.download import download_testdata
  from test_generalized_conv2d import change_ndarray_layout
label_desc: Use image node_id 19 for calling a global function with example usage: test_qnn_conv2d_mobilenetv1_layer(interpreter, layer, output_layout) and returns: True