-
Notifications
You must be signed in to change notification settings - Fork 7.2k
Closed
Description
🚀 The feature
In the current _get_enum_from_fn implementation, there are two things that can be refined.
- https://github.com/pytorch/vision/blob/main/torchvision/models/_api.py#L167-L171,
signaturefunction was called twice, but I think it only needs one call.
def _get_enum_from_fn(fn: Callable) -> Type[WeightsEnum]:
sig = signature(fn)
if "weights" not in sig.parameters:
raise ValueError("The method is missing the 'weights' argument.")
ann = sig.parameters["weights"].annotation # <-- here- resolve the
TODOat line https://github.com/pytorch/vision/blob/main/torchvision/models/_api.py#L177, since torch already removed its support from py3.8, there should be no risk making that modification.
Motivation, pitch
Just saw this and think it'd be helpful?
Alternatives
No response
Additional context
No response
Metadata
Metadata
Assignees
Labels
No labels