[12/N] Use std::optional (#132361)

Follows #132396

Pull Request resolved: https://github.com/pytorch/pytorch/pull/132361
Approved by: https://github.com/eqy
This commit is contained in:
cyy
2024-08-02 13:46:44 +00:00
committed by PyTorch MergeBot
parent 56f2917bef
commit b9cb1abf65
63 changed files with 204 additions and 208 deletions

View File

@ -42,8 +42,8 @@ def unwrap_tensor(name: str, cur_level_var: str) -> list[str]:
def unwrap_optional_tensor(name: str, cur_level_var: str) -> list[str]:
result = f"""\
optional<Tensor> {name}_value;
optional<int64_t> {name}_bdim;
std::optional<Tensor> {name}_value;
std::optional<int64_t> {name}_bdim;
if ({name}) {{
std::tie({name}_value, {name}_bdim) = unwrapTensorAtLevel({name}.value(), {cur_level_var});
}}"""