class_docstr: A dispatcher that finds the best ONNX Function for ATen/Custom operators.
  
  It uses the `torch.ops` name to find the function. If not found, it falls back to default.
  Otherwise, the best match is found among all function overloads. An exact match has
  higher precedence over the closest ones.
  
  Below is a breakdown on how the dispatch mechanism works:
  
  1. Use the torch.ops name to find the function:
      a. Check if the ATen overload exists in the registry.
      b. If not, check if the default overload exists in the registry.
  
  2. Find the nearest match among all overloaded functions:
      a. If the types match perfectly, select the function.
      b. Otherwise, find the nearest one with the highest matching score. Because of
          the potential wrongly annotated dtypes and attributes matching, we use
          nearest match to find the best function once the aten name is targeted.
  
  3. Tie-breaker: If there are multiple nearest matches, we will select the one with
      the highest matching score.
  
  NOTE: The nearest match `doesn't guarantee` a correct match, and a warning message is logged.
docstr: Get the OpName from the target.
  
  Args:
      node: The TorchFX node to get the aten name for.
      diagnostic_context: The diagnostic context to use for reporting errors.
  
  Returns:
      The internal op name within dataclass: registration.OpName.
docstr_tok: ["Get","the","OpName","from","the","target",".","Args",":","node",":","The","TorchFX","node","to","get","the","aten","name","for",".","diagnostic_context",":","The","diagnostic","context","to","use","for","reporting","errors",".","Returns",":","The","internal","op","name","within","dataclass",":","registration.OpName","."]
code: def _get_aten_name(
      self,
      node: torch.fx.Node,
      diagnostic_context: diagnostics.DiagnosticContext,
  ) -> registration.OpName:
      """Get the OpName from the target.
  
      Args:
          node: The TorchFX node to get the aten name for.
          diagnostic_context: The diagnostic context to use for reporting errors.
  
      Returns:
          The internal op name within dataclass: registration.OpName.
      """
      if node.target == operator.getitem:
          return registration.OpName.from_name_parts(
              namespace="aten", op_name="getitem"
          )
      if isinstance(node.target, torch._ops.OpOverloadPacket):
          # aten::sym_size is the only OverloadPacket that we support.
          # schema: aten::sym_size(Tensor self, int dim) -> Tensor
          if node.target != torch.ops.aten.sym_size:
              diagnostic = diagnostics.UnsupportedFxNodeDiagnostic(
                  diagnostics.rules.no_symbolic_function_for_call_function,
                  diagnostics.levels.ERROR,
                  f"Unsupported OverloadPacket: {node.target}, aten.sym_size is the only allowed OverloadPacket!",
                  unsupported_fx_node=node,
              )
              diagnostic_context.log(diagnostic)
              raise diagnostics.RuntimeErrorWithDiagnostic(diagnostic)
          # TODO(titaiwang): aten::sym_size has overload, but fx graph is using
          # overloadpacket for some reasons.
          # https://github.com/pytorch/pytorch/issues/97201
          aten_op_default = node.target.default
          return registration.OpName.from_op_overload(op_overload=aten_op_default)  # type: ignore[no-any-return]
  
      if isinstance(node.target, types.BuiltinFunctionType):
          # Make sure it's symint/symfloat consuming builtin ops.
          for node_arg in node.args:
              if (
                  not isinstance(node_arg, (torch.fx.Node, int, float))
              ) or (
                  isinstance(node_arg, torch.fx.Node)
                  and not fx_type_utils.is_torch_symbolic_type(
                      node_arg.meta["val"]
                  )
              ):
                  # TODO: reduce number of explicit initializations.
                  # TODO: Log location, stack.
                  diagnostic = diagnostics.UnsupportedFxNodeDiagnostic(
                      diagnostics.rules.no_symbolic_function_for_call_function,
                      diagnostics.levels.ERROR,
                      f"Unsupported node arg: {node_arg} (type {type(node_arg)}) with builtin function: {node.target},"
                      " only int/float/SymInt/SymFloat is supported with built-in ops!",
                      unsupported_fx_node=node,
                  )
                  diagnostic_context.log(diagnostic)
                  raise diagnostics.RuntimeErrorWithDiagnostic(
                      diagnostic
                  )
          return registration.OpName.from_builtin_function(node.target)
  
      if isinstance(node.target, torch._ops.OpOverload):
          return registration.OpName.from_op_overload(
              op_overload=node.target
          )
  
      # Unexpected target, raise error.
      diagnostic = diagnostics.UnsupportedFxNodeDiagnostic(
          diagnostics.rules.no_symbolic_function_for_call_function,
          diagnostics.levels.ERROR,
          f"Unknown call_function target: {node.target}",
          unsupported_fx_node=node,
      )
      diagnostic_context.log(diagnostic)
      raise diagnostics.RuntimeErrorWithDiagnostic(diagnostic)
  
imports: from __future__ import annotations
  import logging
  import operator
  import types
  from typing import Any, Callable, Dict, List, Optional, Sequence, Set, Tuple, TYPE_CHECKING, Union
  import torch
  import torch._ops
  import torch.fx
  from torch.onnx._internal import _beartype
  from torch.onnx._internal.fx import diagnostics, registration, type_utils
  from onnxscript.function_libs.torch_lib import graph_building
label_desc: Use image node_id 5 for calling the OnnxFunctionDispatcher obj's underlying member method code with example usage: obj._get_aten_name(node, diagnostic_context) and returns: registration, registration, registration, registration