[BE] Add type annotation to eliminate_dead_code (#142251)

Test Plan: CI

Reviewed By: evanleed

Differential Revision: D66887283

Pull Request resolved: https://github.com/pytorch/pytorch/pull/142251
Approved by: https://github.com/ezyang, https://github.com/Skylion007
This commit is contained in:
Marvin Kim 2024-12-10 09:27:29 +00:00 committed by PyTorch MergeBot
parent 539286a67b
commit 3d04de6b2f
2 changed files with 2 additions and 2 deletions

View file

@ -12,7 +12,7 @@ torch.fx.graph.Graph.call_function(self, the_function: Callable[..., Any], args:
torch.fx.graph.Graph.call_method(self, method_name: str, args: Optional[Tuple[Argument, ...]] = None, kwargs: Optional[Dict[str, Argument]] = None, type_expr: Optional[Any] = None) -> torch.fx.node.Node
torch.fx.graph.Graph.call_module(self, module_name: str, args: Optional[Tuple[Argument, ...]] = None, kwargs: Optional[Dict[str, Argument]] = None, type_expr: Optional[Any] = None) -> torch.fx.node.Node
torch.fx.graph.Graph.create_node(self, op: str, target: 'Target', args: Optional[Tuple[Argument, ...]] = None, kwargs: Optional[Dict[str, Argument]] = None, name: Optional[str] = None, type_expr: Optional[Any] = None) -> torch.fx.node.Node
torch.fx.graph.Graph.eliminate_dead_code(self, is_impure_node: Optional[Callable[[torch.fx.node.Node], bool]] = None)
torch.fx.graph.Graph.eliminate_dead_code(self, is_impure_node: Optional[Callable[[torch.fx.node.Node], bool]] = None) -> bool
torch.fx.graph.Graph.erase_node(self, to_erase: torch.fx.node.Node) -> None
torch.fx.graph.Graph.get_attr(self, qualified_name: str, type_expr: Optional[Any] = None) -> torch.fx.node.Node
torch.fx.graph.Graph.graph_copy(self, g: 'Graph', val_map: Dict[torch.fx.node.Node, torch.fx.node.Node], return_output_node = False) -> 'Optional[Argument]'

View file

@ -1815,7 +1815,7 @@ class Graph:
@compatibility(is_backward_compatible=True)
def eliminate_dead_code(
self, is_impure_node: Optional[Callable[[Node], bool]] = None
):
) -> bool:
"""
Remove all dead code from the graph, based on each node's number of
users, and whether the nodes have any side effects. The graph must be