Skip to content

Commit

Permalink
add option to remove passes (pytorch#84425)
Browse files Browse the repository at this point in the history
Summary:
Add a remove_pass method in pass_manager to provide user option to remove any pass.

Reviewed By: wushirong

Differential Revision: D39080077

Pull Request resolved: pytorch#84425
Approved by: https://github.com/yinghai
  • Loading branch information
Wei Wei authored and pytorchmergebot committed Sep 7, 2022
1 parent 2feb31c commit 31ef8dd
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions torch/fx/passes/pass_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,16 @@ def add_constraint(self, constraint):
self.constraints.append(constraint)
self._validated = False

def remove_pass(self, _passes: List[Callable]):
if _passes is None:
return
passes_left = []
for ps in self.passes:
if ps.__name__ not in _passes:
passes_left.append(ps)
self.passes = passes_left
self._validated = False

def validate(self):
"""
Validates that current pass schedule defined by `self.passes` is valid
Expand Down

0 comments on commit 31ef8dd

Please sign in to comment.