class_docstr: Representing a sequence of fx.Nodes to be formed into a fx.GraphModule.
  
  This class encapsulates metadata and provides building block methods to construct this
  layered abstraction from a sequence of flat fx.Nodes.
  
  Attributes:
  - _stack_meta: Metadata of the module stack.
  - _nodes: List of IR nodes in the module.
  - _reference_root_module: Reference to the root flat fx.GraphModule instance.
class_docstr_tok: ["Representing","a","sequence","of","fx.Nodes","to","be","formed","into","a","fx.GraphModule",".","This","class","encapsulates","metadata","and","provides","building","block","methods","to","construct","this","layered","abstraction","from","a","sequence","of","flat","fx.Nodes",".","Attributes",":","-","_stack_meta",":","Metadata","of","the","module","stack",".","-","_nodes",":","List","of","IR","nodes","in","the","module",".","-","_reference_root_module",":","Reference","to","the","root","flat","fx.GraphModule","instance","."]
docstr: Extract module inputs from the sequence of fx nodes this instance holds.
  
  All node args that are produced by nodes outside of the module are considered module
  inputs. The order of returned module inputs is the same as the their use order.
  
  ### Known limitations
  
  The original ordering of module inputs is not preserved. There is no meta information
  to be found from the `fx.GraphModule` that can be used to recover the original ordering.
  
  Returns:
      Sequence of module inputs.
docstr_tok: ["Extract","module","inputs","from","the","sequence","of","fx","nodes","this","instance","holds",".","All","node","args","that","are","produced","by","nodes","outside","of","the","module","are","considered","module","inputs",".","The","order","of","returned","module","inputs","is","the","same","as","the","their","use","order",".","#","#","#","Known","limitations","The","original","ordering","of","module","inputs","is","not","preserved",".","There","is","no","meta","information","to","be","found","from","the","`","fx.GraphModule","`","that","can","be","used","to","recover","the","original","ordering",".","Returns",":","Sequence","of","module","inputs","."]
code: def module_inputs(self) -> Sequence[torch.fx.Node]:
      """Extract module inputs from the sequence of fx nodes this instance holds.
  
      All node args that are produced by nodes outside of the module are considered module
      inputs. The order of returned module inputs is the same as the their use order.
  
      ### Known limitations
  
      The original ordering of module inputs is not preserved. There is no meta information
      to be found from the `fx.GraphModule` that can be used to recover the original ordering.
  
      Returns:
          Sequence of module inputs.
      """
      nodes = list(self.fx_nodes())
      assert (
          len(nodes) > 0
      ), "Cannot extract module inputs from empty nodes."
      module_inputs: Dict[torch.fx.Node, None] = {}
      node_set: Set[torch.fx.Node] = set(nodes)
  
      def _extract_arg_if_node_outside_module(arg: Any):
          if isinstance(arg, torch.fx.Node) and arg not in node_set:
              module_inputs[arg] = None
  
      for node in nodes:
          pytree.tree_map(
              _extract_arg_if_node_outside_module, node.args
          )
          pytree.tree_map(
              _extract_arg_if_node_outside_module, node.kwargs
          )
      return list(module_inputs.keys())
  
imports: from __future__ import annotations
  import abc
  import collections
  import copy
  import operator
  from typing import Any, Dict, Final, Generator, Iterator, List, Optional, Sequence, Set, Tuple, Union
  import torch
  import torch.fx
  from torch.onnx._internal import _beartype
  from torch.onnx._internal.fx import _pass
  from torch.utils import _pytree
label_desc: Use image node_id 9 for calling the _ModuleNode obj's underlying member method code with example usage: obj.module_inputs() and returns: list