code: def _test_image_network(
      model_url,
      model_sub_path,
      input_dict,
      compile_hash,
      output_count,
      host_ops=0,
      npu_partitions=1,
      run=False,
  ):
      """Test an image network.
  
      Parameters
      ----------
      model_url : str
          The URL to the model.
      model_sub_path : str
          The name of the model file.
      input_dict : dict
          The input dict.
      compile_hash : str, set
          The compile hash(es) to check the compilation output against.
      output_count : int
          The expected number of outputs.
      host_ops : int
          The expected number of host operators.
      npu_partitions : int
          The expected number of Ethos-N partitions.
      run : bool
          Whether or not to try running the network. If hardware isn't
          available, the run will still take place but with a mocked
          inference function, so the results will be incorrect. This is
          therefore just to test the runtime flow is working rather than
          to check the correctness/accuracy.
  
      """
  
      def get_model():
          if model_url[-3:] in ("tgz", "zip"):
              model_path = tf_testing.get_workload_official(
                  model_url,
                  model_sub_path,
              )
          else:
              model_path = download.download_testdata(
                  model_url,
                  model_sub_path,
              )
          return _get_tflite_model(model_path, input_dict, "uint8")
  
      inputs = {}
      for input_name in input_dict:
          input_shape = input_dict[input_name]
          inputs[input_name] = tei.get_real_image(
              input_shape[1], input_shape[2]
          )
  
      mod, params = get_model()
      m = tei.build(
          mod,
          params,
          npu=True,
          expected_host_ops=host_ops,
          npu_partitions=npu_partitions,
      )
      tei.assert_lib_hash(m.get_lib(), compile_hash)
      if run:
          tei.run(m, inputs, output_count, npu=True)
  
file_path: tvm/tests/python/contrib/test_ethosn/test_networks.py
imports: import pytest
  import tflite.Model
  from tvm import relay
  from tvm.testing import requires_ethosn
  from tvm.contrib import download
  import tvm.relay.testing.tf
  from .None import infrastructure
label_desc: Use image node_id 2 for calling a global function with example usage: _test_image_network(model_url, model_sub_path, input_dict, compile_hash, output_count, host_ops, npu_partitions, run) and returns: _get_tflite_model