You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def_get_enum_from_fn(fn: Callable) ->Type[WeightsEnum]:
sig=signature(fn)
if"weights"notinsig.parameters:
raiseValueError("The method is missing the 'weights' argument.")
ann=sig.parameters["weights"].annotation# <-- here
Thanks for the report @GdoongMathew . I agree with you that this could be cleaned up, however I don't think it would lead to a significant improvement - that part of the code-base "just works" and we don't really need to touch it as it's not a hot path.
If you'd like to submit a PR though, I'll make sure to review it.
🚀 The feature
In the current
_get_enum_from_fn
implementation, there are two things that can be refined.signature
function was called twice, but I think it only needs one call.TODO
at 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
The text was updated successfully, but these errors were encountered: