Skip to content

Commit f4dcf2a

Browse files
cyyeverpytorchmergebot
authored andcommitted
[1/N] Change #include <c10/util/Optional.h> to #include <optional> (pytorch#128301)
Fixes #ISSUE_NUMBER Pull Request resolved: pytorch#128301 Approved by: https://github.com/ezyang, https://github.com/r-barnes
1 parent f053be2 commit f4dcf2a

File tree

328 files changed

+1204
-1202
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

328 files changed

+1204
-1202
lines changed

aten/src/ATen/CPUGeneratorImpl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include <ATen/core/Generator.h>
44
#include <ATen/core/MT19937RNGEngine.h>
55
#include <c10/core/GeneratorImpl.h>
6-
#include <c10/util/Optional.h>
6+
#include <optional>
77

88
namespace at {
99

aten/src/ATen/InferSize.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include <c10/core/ScalarType.h>
55
#include <c10/core/SymIntArrayRef.h>
66
#include <c10/util/DimVector.h>
7-
#include <c10/util/Optional.h>
7+
#include <optional>
88
#include <sstream>
99
#include <vector>
1010

aten/src/ATen/SavedTensorHooks.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ void SavedTensorDefaultHooks::disable(const std::string& message) {
3232
}
3333

3434
void SavedTensorDefaultHooks::enable() {
35-
tls.disabled_error_message = c10::nullopt;
35+
tls.disabled_error_message = std::nullopt;
3636
}
3737

3838
/* static */ bool SavedTensorDefaultHooks::set_tracing(bool is_tracing) {

aten/src/ATen/SavedTensorHooks.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#pragma once
22

33
#include <c10/macros/Export.h>
4-
#include <c10/util/Optional.h>
54
#include <c10/util/python_stub.h>
5+
#include <optional>
66
#include <stack>
77
#include <string>
88

aten/src/ATen/TensorIndexing.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
#include <ATen/core/Tensor.h>
66
#include <ATen/core/TensorBody.h>
77
#include <c10/core/SymInt.h>
8-
#include <c10/util/Optional.h>
98
#include <c10/util/irange.h>
9+
#include <optional>
1010

1111
#ifndef AT_PER_OPERATOR_HEADERS
1212
#include <ATen/Functions.h>

aten/src/ATen/native/BatchLinearAlgebra.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#pragma once
22

3-
#include <c10/util/Optional.h>
3+
#include <optional>
44
#include <c10/util/string_view.h>
55
#include <ATen/Config.h>
66
#include <ATen/native/DispatchStub.h>

aten/src/ATen/record_function.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
#include <ATen/core/ivalue.h>
44
#include <ATen/core/operator_name.h>
55
#include <c10/macros/Export.h>
6-
#include <c10/util/Optional.h>
76
#include <c10/util/SmallVector.h>
7+
#include <optional>
88

99
#include <array>
1010
#include <functional>

c10/core/ConstantSymNodeImpl.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
#include <c10/core/SymNodeImpl.h>
44
#include <c10/macros/Export.h>
55
#include <c10/util/Exception.h>
6-
#include <c10/util/Optional.h>
76
#include <cstdint>
7+
#include <optional>
88
#include <string>
99
#include <variant>
1010

@@ -73,14 +73,14 @@ class C10_API ConstantSymNodeImpl : public SymNodeImpl {
7373
if constexpr (is_int_()) {
7474
return ::std::get<int64_t>(value_);
7575
} else {
76-
return c10::nullopt;
76+
return std::nullopt;
7777
}
7878
}
7979
std::optional<bool> constant_bool() override {
8080
if constexpr (is_bool_()) {
8181
return ::std::get<bool>(value_);
8282
} else {
83-
return c10::nullopt;
83+
return std::nullopt;
8484
}
8585
}
8686
bool is_constant() override {

c10/core/ScalarTypeToTypeMeta.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ inline ScalarType typeMetaToScalarType(caffe2::TypeMeta dtype) {
3030
inline optional<at::ScalarType> optTypeMetaToScalarType(
3131
optional<caffe2::TypeMeta> type_meta) {
3232
if (!type_meta.has_value()) {
33-
return c10::nullopt;
33+
return std::nullopt;
3434
}
3535
return type_meta->toScalarType();
3636
}

c10/core/SymBool.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
#include <c10/core/SymNodeImpl.h>
44
#include <c10/macros/Export.h>
55
#include <c10/util/Exception.h>
6-
#include <c10/util/Optional.h>
76
#include <c10/util/intrusive_ptr.h>
87
#include <cstdint>
8+
#include <optional>
99
#include <ostream>
1010
#include <utility>
1111

@@ -68,7 +68,7 @@ class C10_API SymBool {
6868

6969
std::optional<bool> maybe_as_bool() const {
7070
if (!is_heap_allocated()) {
71-
return c10::make_optional(data_);
71+
return std::make_optional(data_);
7272
}
7373
return toSymNodeImplUnowned()->constant_bool();
7474
}

0 commit comments

Comments
 (0)