Document torch.jit.frontend.get_default_args (#128408)

Fixes #127896

### Description
Add docstring to `torch/jit/frontend.py:get_default_args` function

### Checklist
- [x] The issue that is being fixed is referred in the description
- [x] Only one issue is addressed in this pull request
- [x] Labels from the issue that this PR is fixing are added to this pull request
- [x] No unnecessary issues are included into this pull request

Co-authored-by: Nikita Shulga <2453524+malfet@users.noreply.github.com>
Pull Request resolved: https://github.com/pytorch/pytorch/pull/128408
Approved by: https://github.com/malfet
This commit is contained in:
Andrew Hoblitzell
2024-06-13 21:49:16 +00:00
committed by PyTorch MergeBot
parent bf8a05f483
commit 6211e67e49

View File

@ -603,6 +603,15 @@ def build_ignore_context_manager(ctx, stmt):
def get_default_args(fn):
"""
Get a dictionary of default arguments for a function.
Args:
fn: Callable - The function to inspect for default arguments.
Returns:
(Dict[str, Any]): mapping argument names to their default values if
:attr:`fn` is not None, else empty dictionary.
"""
if fn is None:
return {}