code: def test_onnx_export(self, use_trace):
      meta_file = os.path.join(
          os.path.dirname(__file__), "testing_data", "metadata.json"
      )
      config_file = os.path.join(
          os.path.dirname(__file__), "testing_data", "inference.json"
      )
      with tempfile.TemporaryDirectory() as tempdir:
          def_args = {
              "meta_file": "will be replaced by `meta_file` arg"
          }
          def_args_file = os.path.join(tempdir, "def_args.yaml")
  
          ckpt_file = os.path.join(tempdir, "model.pt")
          onnx_file = os.path.join(tempdir, "model.onnx")
  
          parser = ConfigParser()
          parser.export_config_file(
              config=def_args, filepath=def_args_file
          )
          parser.read_config(config_file)
          net = parser.get_parsed_content("network_def")
          save_state(src=net, path=ckpt_file)
  
          cmd = [
              "python",
              "-m",
              "monai.bundle",
              "onnx_export",
              "network_def",
              "--filepath",
              onnx_file,
          ]
          cmd += [
              "--meta_file",
              meta_file,
              "--config_file",
              f"['{config_file}','{def_args_file}']",
          ]
          cmd += [
              "--ckpt_file",
              ckpt_file,
              "--args_file",
              def_args_file,
              "--input_shape",
              "[1, 1, 96, 96, 96]",
          ]
          cmd += ["--use_trace", use_trace]
          command_line_tests(cmd)
          self.assertTrue(os.path.exists(onnx_file))
  
file_path: MONAI/tests/test_bundle_onnx_export.py
imports: from __future__ import annotations
  import os
  import tempfile
  import unittest
  from parameterized import parameterized
  from monai.bundle import ConfigParser
  from monai.networks import save_state
  from tests.utils import SkipIfBeforePyTorchVersion, SkipIfNoModule, command_line_tests, skip_if_windows
label_desc: Use image node_id 3 for calling the TestONNXExport obj's underlying member method code with example usage: obj.test_onnx_export(use_trace) without return types