code: def _get_network(
      args: Tuple[str, List[int], Optional[str]]
  ) -> Tuple[IRModule, bytearray, Tuple[str, List[int], str]]:
      name: str
      input_shape: List[int]
      layout: Optional[str]
      name, input_shape, layout = args
  
      if layout == "None":
          layout = None
  
      mod: IRModule
      if name in [
          "resnet_18",
          "resnet_50",
          "wide_resnet_50",
          "resnext_50",
          "mobilenet_v2",
          "mobilenet_v3",
          "inception_v3",
          "densenet_121",
          "resnet3d_18",
          "vgg_16",
      ]:
          import torch  # type: ignore
          from torchvision import models  # type: ignore
  
          assert layout is None or layout in ["NCHW", "NHWC"]
  
          params: Dict[str, Any] = {}
          if name in ["resnet_18", "resnet_50"]:
              model = getattr(models, name.replace("_", ""))
          elif name == "wide_resnet_50":
              model = getattr(models, "wide_resnet50_2")
          elif name == "resnext_50":
              model = getattr(models, "resnext50_32x4d")
          elif name == "mobilenet_v2":
              model = getattr(models, name)
          elif name == "mobilenet_v3":
              model = getattr(models, name + "_large")
          elif name == "inception_v3":
              model = getattr(models, name)
              params["aux_logits"] = False
          elif name == "densenet_121":
              model = getattr(models, name.replace("_", ""))
          elif name == "resnet3d_18":
              model = models.video.r3d_18
          elif name == "vgg_16":
              model = getattr(models, name.replace("_", ""))
          try:
              model = model(**params, weights=None)
          except TypeError:
              model = model(**params, pretrained=False)
  
          dtype = "float32"
          input_data = torch.randn(
              input_shape
          ).type(  # pylint: disable=no-member
              {
                  "float32": torch.float32,  # pylint: disable=no-member
              }[dtype]
          )
          scripted_model = torch.jit.trace(model, input_data).eval()  # type: ignore
          input_name = "input0"
          shape_list = [(input_name, input_shape)]
          mod, params = relay.frontend.from_pytorch(
              scripted_model, shape_list
          )
          passes = [relay.transform.RemoveUnusedFunctions()]
          if layout is None or layout == "NHWC":
              # PyTorch is imported as NCHW by default
              passes.append(
                  relay.transform.ConvertLayout(
                      {
                          "nn.conv2d": ["NHWC", "default"],
                          "nn.conv3d": ["NDHWC", "default"],
                          "nn.max_pool2d": ["NHWC", "default"],
                          "nn.avg_pool2d": ["NHWC", "default"],
                      }
                  )
              )
          with tvm.transform.PassContext(opt_level=3):
              mod = tvm.transform.Sequential(passes)(mod)
          inputs = (input_name, input_shape, dtype)
      elif name in [
          "bert_tiny",
          "bert_base",
          "bert_medium",
          "bert_large",
      ]:
          os.environ["TOKENIZERS_PARALLELISM"] = "false"
          # pip3 install transformers==3.5 torch==1.7
          import torch  # type: ignore
          import transformers  # type: ignore
  
          assert layout is None
  
          config_dict = {
              "bert_tiny": transformers.BertConfig(
                  num_hidden_layers=6,
                  hidden_size=512,
                  intermediate_size=2048,
                  num_attention_heads=8,
                  return_dict=False,
              ),
              "bert_base": transformers.BertConfig(
                  num_hidden_layers=12,
                  hidden_size=768,
                  intermediate_size=3072,
                  num_attention_heads=12,
                  return_dict=False,
              ),
              "bert_medium": transformers.BertConfig(
                  num_hidden_layers=12,
                  hidden_size=1024,
                  intermediate_size=4096,
                  num_attention_heads=16,
                  return_dict=False,
              ),
              "bert_large": transformers.BertConfig(
                  num_hidden_layers=24,
                  hidden_size=1024,
                  intermediate_size=4096,
                  num_attention_heads=16,
                  return_dict=False,
              ),
          }
          configuration = config_dict[name]
          model = transformers.BertModel(configuration)
          input_name = "input_ids"
          input_dtype = "int64"
          a = torch.randint(
              10000, input_shape
          )  # pylint: disable=no-member
          model.eval()
          scripted_model = torch.jit.trace(model, [a], strict=False)  # type: ignore
          input_name = "input_ids"
          shape_list = [(input_name, input_shape)]
          mod, params = relay.frontend.from_pytorch(
              scripted_model, shape_list
          )
          mod = relay.transform.FastMath()(mod)
          mod = relay.transform.CombineParallelBatchMatmul()(mod)
          inputs = (input_name, input_shape, input_dtype)
      elif name == "dcgan":
          assert layout is None
  
          output_shape = input_shape
          batch_size = output_shape[0]
          oshape = output_shape[1:]
          mod, params = relay.testing.dcgan.get_workload(
              batch_size=batch_size,
              oshape=oshape,
              layout="NHWC",
          )
          inputs = ("data", [100], "float32")
      else:
          raise ValueError("Invalid name: " + name)
  
      params_bytearray: bytearray = save_param_dict(params)
      return mod, params_bytearray, inputs
  
file_path: tvm/python/tvm/meta_schedule/testing/relay_workload.py
imports: import logging
  import multiprocessing
  import os
  import pickle
  from typing import Any, Dict, List, Optional, Tuple
  import tvm
  import tvm.relay.testing
  from tvm import meta_schedule
  from tvm import relay
  from tvm.ir import IRModule
  from tvm.runtime import NDArray, load_param_dict, save_param_dict
  from tvm.target import Target
label_desc: Use image node_id 1 for calling a global function with example usage: _get_network(args) and returns: mod,  params_bytearray,  inputs