code: def test_missing_complex_onnx_variant_raises_errors_in_dispatcher(
      self,
  ):
      registry = torch.onnx.OnnxRegistry()
  
      # NOTE: simulate unsupported nodes
      aten_mul_tensor = registration.OpName.from_name_parts(
          namespace="aten", op_name="mul", overload="Tensor"
      )
  
      # Only keep real aten.mul to test missing complex aten.mul
      registry._registry[aten_mul_tensor] = [
          onnx_func
          for onnx_func in registry._registry[aten_mul_tensor]
          if not onnx_func.is_complex
      ]
  
      class TraceModel(torch.nn.Module):
          def forward(self, input):
              return torch.ops.aten.mul.Tensor(input, input)
  
      x = torch.tensor([1 + 2j, 3 + 4j], dtype=torch.complex64)
  
      with self.assertRaises(torch.onnx.OnnxExporterError) as e:
          torch.onnx.dynamo_export(
              TraceModel(),
              x,
              export_options=torch.onnx.ExportOptions(
                  onnx_registry=registry
              ),
          )
  
      try:
          torch.onnx.dynamo_export(
              TraceModel(),
              x,
              export_options=torch.onnx.ExportOptions(
                  onnx_registry=registry
              ),
          )
      except torch.onnx.OnnxExporterError as e:
          assert_has_diagnostics(
              e.onnx_program.diagnostic_context,
              diagnostics.rules.no_symbolic_function_for_call_function,
              diagnostics.levels.ERROR,
              expected_node="aten.mul.Tensor",
          )
  
imports: from __future__ import annotations
  import io
  import tempfile
  from typing import Mapping, Tuple
  import onnx
  import pytorch_test_common
  import torch
  import transformers
  from torch import nn
  from torch._subclasses import fake_tensor
  from torch.nn import functional
  from torch.onnx import dynamo_export, ExportOptions
  from torch.onnx._internal.diagnostics import infra
  from torch.onnx._internal.fx import diagnostics, registration
  from torch.testing._internal import common_utils
label_desc: Use image node_id 15 for calling the TestFxToOnnx obj's underlying member method code with example usage: obj.test_missing_complex_onnx_variant_raises_errors_in_dispatcher() and returns: torch