Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions torchvision/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -562,9 +562,10 @@ def _log_api_usage_once(obj: Any) -> None:
Args:
obj (class instance or method): an object to extract info from.
"""
if not obj.__module__.startswith("torchvision"):
return
module = obj.__module__
if not module.startswith("torchvision"):
module = f"torchvision.internal.{module}"
name = obj.__class__.__name__
if isinstance(obj, FunctionType):
name = obj.__name__
torch._C._log_api_usage_once(f"{obj.__module__}.{name}")
torch._C._log_api_usage_once(f"{module}.{name}")