code: def build(target_dir):
      """Compiles resnet18 with TVM"""
      # Download the pretrained model in MxNet's format.
      block = get_model("resnet18_v1", pretrained=True)
  
      shape_dict = {"data": (1, 3, 224, 224)}
      mod, params = relay.frontend.from_mxnet(block, shape_dict)
      # Add softmax to do classification in last layer.
      func = mod["main"]
      func = relay.Function(
          func.params,
          relay.nn.softmax(func.body),
          None,
          func.type_params,
          func.attrs,
      )
  
      target = "llvm"
      with tvm.transform.PassContext(opt_level=3):
          graph, lib, params = relay.build(func, target, params=params)
  
      # save the model artifacts
      deploy_lib = osp.join(target_dir, "deploy_lib.o")
      lib.save(deploy_lib)
      cc.create_shared(
          osp.join(target_dir, "deploy_lib.so"),
          [osp.join(target_dir, "deploy_lib.o")],
      )
  
      with open(osp.join(target_dir, "deploy_graph.json"), "w") as fo:
          fo.write(graph)
  
      with open(
          osp.join(target_dir, "deploy_param.params"), "wb"
      ) as fo:
          fo.write(runtime.save_param_dict(params))
  
file_path: tvm/rust/tvm/examples/resnet/src/build_resnet.py
imports: import argparse
  import csv
  import logging
  from os import path
  import sys
  import shutil
  import numpy
  import tvm
  from tvm import te
  from tvm import relay, runtime
  from tvm.relay import testing
  from tvm.contrib import graph_executor, cc
  from PIL import Image
  from tvm.contrib.download import download_testdata
  from mxnet.gluon.model_zoo.vision import get_model
label_desc: Use image node_id 1 for calling a global function with example usage: build(target_dir) without return types