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: 9bfc70d6a5fc3288cc749648356d730ed90199da Pull Request resolved: #93013 rm unused
- Loading branch information
1 parent
e292ddf
commit 7b70431
Showing
8 changed files
with
93 additions
and
6 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
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 |