8000 Land 'to_std' utility parser #93209 · pytorch/pytorch@68c93dd · GitHub
[go: up one dir, main page]

Skip to content

Commit 68c93dd

Browse files
committed
Land 'to_std' utility parser #93209
[ghstack-poisoned]
1 parent bd4a5b4 commit 68c93dd

File tree

1 file changed

+3
-4
lines changed
  • torch/distributed/elastic/multiprocessing

1 file changed

+3
-4
lines changed

torch/distributed/elastic/multiprocessing/api.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,10 @@ def from_str(cls, vm: str) -> Union["Std", Dict[int, "Std"]]:
117117
Any other input raises an exception
118118
"""
119119

120-
def to_std(v):
121-
v = int(v)
120+
def to_std(v: str) -> Std: # type: ignore[return]
121+
s = Std(int(v))
122122
for s in Std:
123-
if s == v:
124-
return s
123+
return s
125124
# return None -> should NEVER reach here since we regex check input
126125

127126
if re.match(_VALUE_REGEX, vm): # vm is a number (e.g. 0)

0 commit comments

Comments
 (0)
0