Skip to content

Commit ae72fa2

Browse files
authored
introduce img_root_secondary to torchx macros
Differential Revision: D74093902 Pull Request resolved: #1060
1 parent 7c67d59 commit ae72fa2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

torchx/specs/api.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,11 +224,15 @@ def _apply_nested(self, d: typing.Dict[str, Any]) -> typing.Dict[str, Any]:
224224
v[i] = self.substitute(v[i])
225225
return d
226226

227+
# Overrides the asdict method to generate a dictionary of macro values to be substituted.
228+
def to_dict(self) -> Dict[str, Any]:
229+
return asdict(self)
230+
227231
def substitute(self, arg: str) -> str:
228232
"""
229233
substitute applies the values to the template arg.
230234
"""
231-
return Template(arg).safe_substitute(**asdict(self))
235+
return Template(arg).safe_substitute(**self.to_dict())
232236

233237

234238
class RetryPolicy(str, Enum):

0 commit comments

Comments
 (0)