code: def model_fn(model_dir):
      """
      Load the onnx model. Called once when hosting service starts.
  
      :param: model_dir The directory where model files are stored.
      :return: a model
      """
      onnx_path = os.path.join(model_dir, "model.onnx")
      ctx = mx.cpu()  # todo: pass into function
      # load onnx model symbol and parameters
      sym, arg_params, aux_params = onnx_mxnet.import_model(onnx_path)
      model_metadata = onnx_mxnet.get_model_metadata(onnx_path)
      # first index is name, second index is shape
      input_names = [
          inputs[0]
          for inputs in model_metadata.get("input_tensor_data")
      ]
      input_symbols = [mx.sym.var(i) for i in input_names]
      net = gluon.nn.SymbolBlock(outputs=sym, inputs=input_symbols)
      net_params = net.collect_params()
      # set parameters (on correct context)
      for param in arg_params:
          if param in net_params:
              net_params[param]._load_init(arg_params[param], ctx=ctx)
      for param in aux_params:
          if param in net_params:
              net_params[param]._load_init(aux_params[param], ctx=ctx)
      # hybridize for increase performance
      net.hybridize()
      return net
  
imports: import os
  import json
  import mxnet
  from mxnet.contrib import onnx
  from mxnet import gluon, nd
label_desc: Use image node_id 1 for calling a global function with example usage: model_fn(model_dir) and returns: net