We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 03d1133 commit f670152Copy full SHA for f670152
torchvision/prototype/models/_api.py
@@ -60,9 +60,8 @@ def verify(cls, obj: Any) -> Any:
60
61
@classmethod
62
def from_str(cls, value: str) -> "WeightsEnum":
63
- for k, v in cls.__members__.items():
64
- if k == value:
65
- return v
+ if value in cls.__members__:
+ return cls.__members__[value]
66
raise ValueError(f"Invalid value {value} for enum {cls.__name__}.")
67
68
def get_state_dict(self, progress: bool) -> OrderedDict:
0 commit comments