code: def generate_input_data(
      input_size, rand_range=(0, 1), torch_device=torch.device("cpu")
  ):
      r1, r2 = rand_range
  
      def random_data(spec):
          if isinstance(spec, TensorType):
              spec_shape = spec.shape.shape
              dtype = nptype_from_builtin(spec.dtype)
          else:
              spec_shape = spec
              dtype = np.float32
  
          static_shape = tuple(
              [
                  np.random.randint(
                      dim.lower_bound,
                      dim.upper_bound if dim.upper_bound > 0 else 10,
                  )
                  if isinstance(dim, RangeDim)
                  else dim
                  for dim in spec_shape
              ]
          )
  
          data = (
              np.random.rand(*static_shape)
              if static_shape != ()
              else np.random.rand()
          )
          data = (r1 - r2) * data + r2
          return torch.from_numpy(np.array(data).astype(dtype)).to(
              torch_device
          )
  
      if isinstance(input_size, list):
          return [random_data(size) for size in input_size]
      else:
          return random_data(input_size)
  
imports: import numpy
  import pytest
  import torch
  import torch.nn
  import coremltools
  import coremltools.models.utils
  from coremltools import RangeDim, TensorType
  from coremltools._deps import _HAS_EXECUTORCH, _HAS_TORCH_EXPORT_API, _IS_MACOS
  from coremltools.converters.mil.mil.types.type_mapping import nptype_from_builtin
  from coremltools.converters.mil.testing_utils import ct_convert, validate_minimum_deployment_target
  from ..ops import TorchFrontend
  from ..torchscript_utils import torch_to_mil_types
label_desc: Use image node_id 6 for calling a global function with example usage: generate_input_data(input_size, rand_range, torch_device) and returns: torch, unknown, random_data