parameters: (self, nodes: NodeSet)
return_statement: return split_module, submodule_name
docstring: Split self.module so that one submodule consists of `nodes` and only `nodes`.
  
          Args:
              nodes: Nodes that we want to include in the minimize submodule.
  
          Returns:
              split_module (torch.fx.GraphModule): the module after split.
              submodule_name (str): the name of the submodule that consists of `nodes`.
docstring_summary: Split self.module so that one submodule consists of `nodes` and only `nodes`.
docstring_tokens: Split self . module so that one submodule consists of nodes and only nodes .
function: def _build_submodule(self, nodes: NodeSet) -> Tuple[torch.fx.GraphModule, str]:
          """
          Split self.module so that one submodule consists of `nodes` and only `nodes`.
  
          Args:
              nodes: Nodes that we want to include in the minimize submodule.
  
          Returns:
              split_module (torch.fx.GraphModule): the module after split.
              submodule_name (str): the name of the submodule that consists of `nodes`.
          """
          # Color provided nodes
          self._tag_nodes(nodes)
  
          # Split module based on coloring
          split_module = split_by_tags(self.module, ["main_0", "minimize", "main_1"])
  
          # Find submodule containing colored nodes
          submodule_name: str = ""
          for child_name, _ in split_module.named_children():
              # Skip submodules we're not interested in at the moment
              if "minimize" not in child_name:
                  continue
  
              if submodule_name == "":
                  submodule_name = child_name
              else:
                  raise FxNetMinimizerBadModuleError(
                      f"Expected only one minimize submodule with nodes {nodes}"
                  )
  
          if submodule_name == "":
              raise FxNetMinimizerBadModuleError(
                  f"Minimize submodule was not found with nodes {nodes}"
              )
  
          return split_module, submodule_name
function_tokens: def _build_submodule ( self , nodes : NodeSet ) -> Tuple [ torch . fx . GraphModule , str ] : # Color provided nodes self . _tag_nodes ( nodes ) # Split module based on coloring split_module = split_by_tags ( self . module , [ "main_0" , "minimize" , "main_1" ] ) # Find submodule containing colored nodes submodule_name : str = "" for child_name , _ in split_module . named_children ( ) : # Skip submodules we're not interested in at the moment if "minimize" not in child_name : continue if submodule_name == "" : submodule_name = child_name else : raise FxNetMinimizerBadModuleError ( f"Expected only one minimize submodule with nodes {nodes}" ) if submodule_name == "" : raise FxNetMinimizerBadModuleError ( f"Minimize submodule was not found with nodes {nodes}" ) return split_module , submodule_name