Skip to content

Commit 4ef8486

Browse files
committed
add docstring for _log_api_usage_once
1 parent 59c723c commit 4ef8486

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

torchvision/utils.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,20 @@ def _generate_color_palette(num_masks: int):
388388

389389

390390
def _log_api_usage_once(obj: Any) -> None:
391+
392+
"""
393+
Logs API usage(module and name) within an organization.
394+
In a large ecosystem, it's often useful to track the PyTorch and
395+
TorchVision APIs usage. This function is triggered once for a API call
396+
within a process. By default, no logs is generated unless API usage
397+
instrumentation handler is registered with `SetAPIUsageLogger`(See https://github.com/pytorch/pytorch/blob/eb3b9fe719b21fae13c7a7cf3253f970290a573e/c10/util/Logging.cpp#L104).
398+
For more information, please refer to
399+
* PyTorch note: https://pytorch.org/docs/stable/notes/large_scale_deployments.html#api-usage-logging;
400+
* Logging policy: https://github.com/pytorch/vision/issues/5052;
401+
402+
Args:
403+
obj (class instance or method): an object to extract info from.
404+
"""
391405
if not obj.__module__.startswith("torchvision"):
392406
return
393407
name = obj.__class__.__name__

0 commit comments

Comments
 (0)