Skip to content

Commit 624d926

Browse files
craymichaelfacebook-github-bot
authored andcommitted
Make Captum log_usage universal by supporting async functions
Summary: As title. Checks if function being wrapped is a coroutine and uses an async wrapper instead of sync when logging. Differential Revision: D76837949
1 parent ce452a2 commit 624d926

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

captum/log/dummy_log.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
# pyre-strict
44

5-
from functools import wraps
65
from types import TracebackType
76
from typing import Any, List, Optional, Union
87

@@ -32,13 +31,7 @@ def log_usage(*log_args: Any, **log_kwargs: Any):
3231
# pyre-fixme[3]: Return type must be annotated.
3332
# pyre-fixme[2]: Parameter must be annotated.
3433
def _log_usage(func):
35-
@wraps(func)
36-
# pyre-fixme[53]: Captured variable `func` is not annotated.
37-
# pyre-fixme[3]: Return type must be annotated.
38-
def wrapper(*args: Any, **kwargs: Any):
39-
return func(*args, **kwargs)
40-
41-
return wrapper
34+
return func
4235

4336
return _log_usage
4437

0 commit comments

Comments
 (0)