[codemod] c10:optional -> std::optional (#126135)

Generated by running the following from PyTorch root:
```
find . -regex ".*\.\(cpp\|h\|cu\|hpp\|cc\|cxx\)$" | grep -v "build/" | xargs -n 50 -P 4 perl -pi -e 's/c10::optional/std::optional/'
```

`c10::optional` is just an alias for `std::optional`. This removes usages of that alias in preparation for eliminating it entirely.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/126135
Approved by: https://github.com/Skylion007, https://github.com/malfet, https://github.com/albanD, https://github.com/aaronenyeshi
This commit is contained in:
Richard Barnes
2024-05-14 19:35:49 +00:00
committed by PyTorch MergeBot
parent b55f57b7af
commit ed327876f5
907 changed files with 5655 additions and 5655 deletions

View File

@ -305,7 +305,7 @@ int main(int argc, char** argv) {
torch::jit::GraphOptimizerEnabledGuard no_optimizer_guard(false);
c10::CPUCachingAllocator caching_allocator;
c10::optional<c10::WithCPUCachingAllocatorGuard> caching_allocator_guard;
std::optional<c10::WithCPUCachingAllocatorGuard> caching_allocator_guard;
if (FLAGS_use_caching_allocator) {
caching_allocator_guard.emplace(&caching_allocator);
}

View File

@ -294,7 +294,7 @@ int main(int argc, char** argv) {
}
c10::CPUCachingAllocator caching_allocator;
c10::optional<c10::WithCPUCachingAllocatorGuard> caching_allocator_guard;
std::optional<c10::WithCPUCachingAllocatorGuard> caching_allocator_guard;
if (FLAGS_use_caching_allocator) {
caching_allocator_guard.emplace(&caching_allocator);
}