class_docstr: Stateless class to process FX graph Nodes and translate them into their ONNX counterparts.
  
  All FX nodes described by [FX Graph](https://pytorch.org/docs/stable/fx.html#torch.fx.Graph) are supported.
  Similarly to [FX Interpreter pattern](https://pytorch.org/docs/stable/fx.html#torch.fx.Interpreter), each FX node
  must be implemented on its own method in this class.
  
  Each operator's implementation returns either an `onnxscript.OnnxFunction` or
  `onnxscript.TracedOnnxFunction` instance based on the dispatch algorithm. They can
  also raise RuntimeError: If there are no overloaded functions available for the given FX node.
  
  TODO: Convert methods to @staticmethod when the diagnostic system supports it
        DO NOT ADD NEW ATTRIBUTES TO THIS CLASS!
class_docstr_tok: ["Stateless","class","to","process","FX","graph","Nodes","and","translate","them","into","their","ONNX","counterparts",".","All","FX","nodes","described","by","[","FX","Graph","]","(","https",":","\/\/pytorch.org\/docs\/stable\/fx.html","#","torch.fx.Graph",")","are","supported",".","Similarly","to","[","FX","Interpreter","pattern","]","(","https",":","\/\/pytorch.org\/docs\/stable\/fx.html","#","torch.fx.Interpreter",")",",","each","FX","node","must","be","implemented","on","its","own","method","in","this","class",".","Each","operator","'s","implementation","returns","either","an","`","onnxscript.OnnxFunction","`","or","`","onnxscript.TracedOnnxFunction","`","instance","based","on","the","dispatch","algorithm",".","They","can","also","raise","RuntimeError",":","If","there","are","no","overloaded","functions","available","for","the","given","FX","node",".","TODO",":","Convert","methods","to","@","staticmethod","when","the","diagnostic","system","supports","it","DO","NOT","ADD","NEW","ATTRIBUTES","TO","THIS","CLASS","!"]
code: def get_attr(
      self,
      node: torch.fx.Node,
      onnxscript_graph: onnxscript_graph_building.TorchScriptGraph,
      fx_name_to_onnxscript_value: Dict[
          str,
          Union[
              onnxscript_graph_building.TorchScriptTensor,
              Tuple[onnxscript_graph_building.TorchScriptTensor, ...],
          ],
      ],
      fx_graph_module: torch.fx.GraphModule,
  ):
      # TODO: Constant tensors and buffer/weights are both categorized into `get_attr`,
      # but they are different to ONNX. We need to distinguish them.
      # Constant tensors should become ONNX constants in the graph, while buffers/weights ONNX initializers.
      # For now they are all converted to ONNX initializers.
  
      assert isinstance(
          node.target, str
      ), f"node.target {node.target} is not a str."
      attr_tensor = getattr(fx_graph_module, node.target)
      assert isinstance(
          attr_tensor, torch.Tensor
      ), f"{attr_tensor} is not a tensor."
  
      # Parameter/buffer name cannot contain "."
      # Revert from "/" to restore namespace formatting.
      input_ = onnxscript_graph.add_initializer(
          name=node.target.replace("/", "."),
          value=attr_tensor,
      )
  
      assert isinstance(
          input_, onnxscript_graph_building.TorchScriptTensor
      )
      assert isinstance(input_, onnxscript.tensor.Tensor)
      fx_name_to_onnxscript_value[node.name] = input_
  
imports: from __future__ import annotations
  import inspect
  import logging
  import operator
  import re
  import types
  from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union
  import onnxscript
  from onnxscript.function_libs.torch_lib import graph_building
  import torch
  import torch.fx
  from torch.onnx import _type_utils
  from torch.onnx._internal import _beartype
  from torch.onnx._internal.fx import _pass, diagnostics, onnxfunction_dispatcher, op_validation, type_utils
  from torch.utils import _pytree
label_desc: Use image node_id 9 for calling the FxOnnxInterpreter obj's underlying member method code with example usage: obj.get_attr(node, onnxscript_graph, fx_name_to_onnxscript_value, fx_graph_module) without return types