code: def _build_onnx(
      self, x, dirname=None, thread_num=None, sess_options=None
  ):
      if not self.model_built:
          raise RuntimeError(
              "You must call fit_eval or restore\
                                 first before calling onnx methods!"
          )
      try:
          import onnx
          import onnxruntime
      except:
          raise RuntimeError(
              "You should install onnx and onnxruntime to use onnx based method."
          )
      if dirname is None:
          dirname = tempfile.mkdtemp(prefix="onnx_cache_")
      # code adapted from
      # https://pytorch.org/tutorials/advanced/super_resolution_with_onnxruntime.html
      torch.onnx.export(
          self.model,
          x,
          os.path.join(dirname, "cache.onnx"),
          export_params=True,
          opset_version=10,
          do_constant_folding=True,
          input_names=["input"],
          output_names=["output"],
          dynamic_axes={
              "input": {0: "batch_size"},
              "output": {0: "batch_size"},
          },
      )
      self.onnx_model = onnx.load(os.path.join(dirname, "cache.onnx"))
      onnx.checker.check_model(self.onnx_model)
      if sess_options is None:
          sess_options = onnxruntime.SessionOptions()
          if thread_num is not None:
              sess_options.intra_op_num_threads = thread_num
      self.ort_session = onnxruntime.InferenceSession(
          os.path.join(dirname, "cache.onnx"), sess_options=sess_options
      )
      self.onnx_model_built = True
  
imports: import torch
  from torch.utils.data import TensorDataset, DataLoader
  import types
  import numpy
  import math
  import pandas
  import tempfile
  import os
  from zoo.orca.automl.model.abstract import BaseModel, ModelBuilder
  from zoo.orca.automl.metrics import Evaluator
  from zoo.orca.automl.pytorch_utils import LR_NAME, DEFAULT_LR
label_desc: Use image node_id 22 for calling the PytorchBaseModel obj's underlying member method code with example usage: obj._build_onnx(x, dirname, thread_num, sess_options) without return types