class_docstr: Package of a program from :func:`export`. It contains
  an :class:`torch.fx.Graph` that represents Tensor computation, a state_dict containing
  tensor values of all lifted parameters and buffers, and various metadata.
  
  You can call an ExportedProgram like the original callable traced by
  :func:`export` with the same calling convention.
  
  To perform transformations on the graph, use ``.module`` property to access
  an :class:`torch.fx.GraphModule`. You can then use
  `FX transformation <https://pytorch.org/docs/stable/fx.html#writing-transformations>`_
  to rewrite the graph. Afterwards, you can simply use :func:`export`
  again to construct a correct ExportedProgram.
docstr: Run a set of decompositions on the exported program and returns a new
  exported program. By default we will run the Core ATen decompositions to
  get operators in the
  `Core ATen Operator Set <https://pytorch.org/docs/stable/torch.compiler_ir.html>`_.
  
  For now, we do not decompose joint graphs.
docstr_tok: ["Run","a","set","of","decompositions","on","the","exported","program","and","returns","a","new","exported","program",".","By","default","we","will","run","the","Core","ATen","decompositions","to","get","operators","in","the","`","Core","ATen","Operator","Set","<","https",":","\/\/pytorch.org\/docs\/stable\/torch.compiler_ir.html",">","`","_",".","For","now",",","we","do","not","decompose","joint","graphs","."]
code: def run_decompositions(
      self,
      decomp_table: Optional[
          Dict[torch._ops.OperatorBase, Callable]
      ] = None,
  ) -> "ExportedProgram":
      """
      Run a set of decompositions on the exported program and returns a new
      exported program. By default we will run the Core ATen decompositions to
      get operators in the
      `Core ATen Operator Set <https://pytorch.org/docs/stable/torch.compiler_ir.html>`_.
  
      For now, we do not decompose joint graphs.
      """
      from torch._decomp import core_aten_decompositions
      from torch._export.passes.add_runtime_assertions_for_constraints_pass import (
          _AddRuntimeAssertionsForInlineConstraintsPass,
      )
      from torch._export.passes.lift_constant_tensor_pass import (
          lift_constant_tensor_pass,
      )
      from torch._export.passes.replace_sym_size_ops_pass import (
          _replace_sym_size_ops_pass,
      )
      from torch._functorch.aot_autograd import aot_export_module
  
      def _get_placeholders(gm):
          placeholders = []
          for node in gm.graph.nodes:
              if node.op != "placeholder":
                  break
              placeholders.append(node)
          return placeholders
  
      decomp_table = decomp_table or core_aten_decompositions()
  
      old_placeholders = _get_placeholders(self.graph_module)
      fake_args = [node.meta["val"] for node in old_placeholders]
  
      buffers_to_remove = [
          name for name, _ in self.graph_module.named_buffers()
      ]
      for name in buffers_to_remove:
          delattr(self.graph_module, name)
      # TODO(zhxhchen17) Return the new graph_signature directly.
      gm, graph_signature = aot_export_module(
          self.graph_module,
          fake_args,
          decompositions=decomp_table,
          trace_joint=False,
      )
  
      # Update the signatures with the new placeholder names in case they
      # changed when calling aot_export
      def update_arg(old_arg, new_ph):
          if isinstance(old_arg, ConstantArgument):
              return old_arg
          elif isinstance(old_arg, TensorArgument):
              return TensorArgument(name=new_ph.name)
          elif isinstance(old_arg, SymIntArgument):
              return SymIntArgument(name=new_ph.name)
          raise RuntimeError(
              f"Type of old_arg not supported: {type(old_arg)}"
          )
  
      new_placeholders = _get_placeholders(gm)
      new_outputs = list(gm.graph.nodes)[-1].args[0]
  
      # To match the output target with correct input for input mutations
      # need to find the old to new placeholder map
      old_new_placeholder_map = {
          spec.arg.name: new_placeholders[i].name
          for i, spec in enumerate(self.graph_signature.input_specs)
          if not isinstance(spec.arg, ConstantArgument)
      }
  
      input_specs = [
          InputSpec(
              spec.kind,
              update_arg(spec.arg, new_placeholders[i]),
              spec.target,
          )
          for i, spec in enumerate(self.graph_signature.input_specs)
      ]
      output_specs = [
          OutputSpec(
              spec.kind,
              update_arg(spec.arg, new_outputs[i]),
              old_new_placeholder_map.get(spec.target, spec.target),
          )
          for i, spec in enumerate(self.graph_signature.output_specs)
      ]
  
      assert len(new_placeholders) == len(old_placeholders)
  
      new_graph_signature = ExportGraphSignature(
          input_specs=input_specs, output_specs=output_specs
      )
      # NOTE: aot_export adds symint metadata for placeholders with int
      # values; since these become specialized, we replace such metadata with
      # the original values.
      # Also, set the param/buffer metadata back to the placeholders.
      for old_node, new_node in zip(old_placeholders, new_placeholders):
          if not isinstance(old_node.meta["val"], torch.Tensor):
              new_node.meta["val"] = old_node.meta["val"]
  
          if (
              new_node.target
              in new_graph_signature.inputs_to_parameters
              or new_node.target
              in new_graph_signature.inputs_to_buffers
          ):
              for k, v in old_node.meta.items():
                  new_node.meta[k] = v
  
      # TODO unfortunately preserving graph-level metadata is not
      # working well with aot_export. So we manually copy it.
      # (The node-level meta is addressed above.)
      gm.meta.update(self.graph_module.meta)
  
      new_range_constraints = _get_updated_range_constraints(gm)
  
      lift_constant_tensor_pass(gm, new_graph_signature)
      _replace_sym_size_ops_pass(gm)
      exported_program = ExportedProgram(
          root=gm,
          graph=gm.graph,
          graph_signature=new_graph_signature,
          state_dict=self.state_dict,
          range_constraints=new_range_constraints,
          module_call_graph=copy.deepcopy(self.module_call_graph),
          example_inputs=self.example_inputs,
          verifier=self.verifier,
          tensor_constants=self.tensor_constants,
      )
  
      if len(new_range_constraints) > 0:
          exported_program = exported_program._transform_do_not_use(
              _AddRuntimeAssertionsForInlineConstraintsPass(
                  new_range_constraints
              )
          )
  
      return exported_program
  
imports: import copy
  import dataclasses
  import functools
  import types
  from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Type, TYPE_CHECKING, Union
  import torch
  import torch.fx._pytree
  import torch.utils._pytree
  from torch.fx._compatibility import compatibility
  from torch.fx.experimental.proxy_tensor import maybe_disable_fake_tensor_mode
  from torch.fx.passes.infra.pass_base import PassResult
  from torch.fx.passes.infra.pass_manager import PassManager
  from .graph_signature import _sig_to_specs, ArgumentSpec, ConstantArgument, ExportGraphSignature, InputKind, InputSpec, OutputKind, OutputSpec, SymIntArgument, TensorArgument
label_desc: Use image node_id 20 for calling the ExportedProgram obj's underlying member method code with example usage: obj.run_decompositions(decomp_table) and returns: exported_program, placeholders, old_arg, TensorArgument, SymIntArgument