code: def generate_tensor_data(shape: tuple, dtype: str, fill_mode: str):
      """Generate data to produce a tensor of given shape and dtype.
  
      Random data generation depends on the dtype. For int8 types,
      random integers in the range 0->255 are generated. For all other
      types, random floats are generated in the range -1->1 and then
      cast to the appropriate dtype.
  
      This is used to quickly generate some data to input the models, as
      a way to check that compiled module is sane for running.
  
      Parameters
      ----------
      shape : tuple
          The shape of the tensor.
      dtype : str
          The dtype of the tensor.
      fill_mode : str
          The fill-mode to use, either "zeros", "ones" or "random".
  
      Returns
      -------
      tensor : np.array
          The generated tensor as a np.array.
      """
      if fill_mode == "zeros":
          tensor = np.zeros(shape=shape, dtype=dtype)
      elif fill_mode == "ones":
          tensor = np.ones(shape=shape, dtype=dtype)
      elif fill_mode == "random":
          if "int8" in dtype:
              tensor = np.random.randint(128, size=shape, dtype=dtype)
          else:
              tensor = np.random.uniform(-1, 1, size=shape).astype(
                  dtype
              )
      else:
          raise TVMCException("unknown fill-mode: {}".format(fill_mode))
  
      return tensor
  
imports: from contextlib import ExitStack
  import logging
  import pathlib
  from typing import Dict, Optional, Union
  from tarfile import ReadError
  import argparse
  import sys
  import json
  import numpy
  import tvm
  from tvm import rpc
  from tvm.runtime import vm
  from tvm.autotvm.measure import request_remote
  from tvm.contrib import graph_executor
  from tvm.contrib.debugger import debug_executor
  from tvm.runtime import profiler_vm
  from tvm.relay.param_dict import load_param_dict
  from .None import TVMCException
  from .arguments import TVMCSuppressedArgumentParser
  from .project import get_project_options, get_and_check_options, get_project_dir
  from .main import register_parser
  from .model import TVMCPackage, TVMCResult
  from .result_utils import get_top_results
  from .tracker import tracker_host_port_from_cli
label_desc: Use image node_id 4 for calling a global function with example usage: generate_tensor_data(shape, dtype, fill_mode) and returns: tensor