Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lint ghstack-source-id: 406e8b4342702845d8564073468eb20a84011228 Pull Request resolved: #93013 rm unused stats fix Undo undo Feedback and lint
- Loading branch information
1 parent
e292ddf
commit 357f496
Showing
7 changed files
with
97 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# NOTE! PLEASE KEEP THIS FILE *FREE* OF TORCH DEPS! IT SHOULD BE IMPORTABLE ANYWHERE. | ||
# IF YOU FEEL AN OVERWHELMING URGE TO ADD A TORCH DEP, MAKE A TRAMPOLINE FILE A LA torch._dynamo.utils | ||
# AND SCRUB AWAY TORCH NOTIONS THERE. | ||
import collections | ||
import functools | ||
|
||
simple_call_counter = collections.OrderedDict() | ||
|
||
def count(fn): | ||
@functools.wraps(fn) | ||
def wrapper(*args, **kwargs): | ||
if fn.__qualname__ not in simple_call_counter: | ||
simple_call_counter[fn.__qualname__] = 0 | ||
simple_call_counter[fn.__qualname__] = simple_call_counter[fn.__qualname__] + 1 | ||
return fn(*args, **kwargs) | ||
return wrapper |