class_docstr: A backend compiles (sub-)graphs in torch.fx.GraphModule to onnxruntime.InferenceSession calls.
  
  The compiler entry point is OrtBackend.compile, which
      1. partitions the original graph into supported sub-graphs (type: torch.fx.GraphModule) and unsupported
         sub-graphs.
      2. For each supported sub-graph, it replaces its _wrapped_call function with _ort_accelerated_call.
      3. Inside _ort_accelerated_call, it creates onnxruntime.InferenceSession and calls it to execute the sub-graph.
class_docstr_tok: ["A","backend","compiles","(","sub-",")","graphs","in","torch.fx.GraphModule","to","onnxruntime.InferenceSession","calls",".","The","compiler","entry","point","is","OrtBackend.compile",",","which","1.","partitions","the","original","graph","into","supported","sub-graphs","(","type",":","torch.fx.GraphModule",")","and","unsupported","sub-graphs",".","2",".","For","each","supported","sub-graph",",","it","replaces","its","_wrapped_call","function","with","_ort_accelerated_call",".","3",".","Inside","_ort_accelerated_call",",","it","creates","onnxruntime.InferenceSession","and","calls","it","to","execute","the","sub-graph","."]
code: def _select_eps(
      self, graph_module: torch.fx.GraphModule, *args
  ) -> Sequence[Tuple[str, Mapping[str, Any]]]:
      inferred_eps: Tuple[str, ...] = tuple()
      if self._options.infer_execution_providers:
          if eps_from_args := _infer_ep_from_device(*args):
              # If user feeds CUDA tensor as input argument,
              # we want to use CUDA EP.
              # Thus, `eps_from_args` (deduced from input arguments)
              # has highest priority.
              inferred_eps = eps_from_args
          elif eps_from_graph_module := _infer_ep_from_graph_module(
              graph_module
          ):
              # If there is no EP in input arguments, we deduce EP from
              # graph_module's outputs. Those outputs may come from
              # FakeTensorProp or Dynamo's built-in symbolic shape inference.
              inferred_eps = eps_from_graph_module
  
      selected_eps = []
  
      for ep in (
          *(self._options.preferred_execution_providers or []),
          *_sort_eps(inferred_eps),
          *(
              self._options.default_execution_providers
              or _infer_default_eps()
          ),
      ):
          if isinstance(ep, str):
              ep = (ep, {})
          elif isinstance(ep, tuple) and ep[1] is None:
              ep = (ep[0], {})
          if ep is not None and ep not in selected_eps:
              selected_eps.append(ep)
  
      return selected_eps
  
imports: import dataclasses
  import importlib
  import logging
  from typing import Any, Dict, Final, List, Mapping, Optional, Sequence, Set, Tuple, Union
  from typing_extensions import TypeAlias
  import torch
  import torch._C
  import torch._ops
  import torch._prims.executor
  import torch.fx
  from torch._subclasses.fake_tensor import FakeTensor
  from torch.fx._compatibility import compatibility
  from torch.fx.passes.fake_tensor_prop import FakeTensorProp
  from torch.fx.passes.operator_support import OperatorSupport
  from torch.fx.passes.tools_common import CALLABLE_NODE_OPS
  from torch.utils import _pytree
label_desc: Use image node_id 2 for calling the OrtBackend obj's underlying member method code with example usage: obj._select_eps(graph_module) and returns: selected_eps