diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 99e47ef5029..f71f1f98ad6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -878,7 +878,7 @@ Process 87741 stopped * thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1 frame #0: 0x00000001024e2628 libtorch_python.dylib`at::indexing::impl::applySelect(self=0x00000001004ee8a8, dim=0, index=(data_ = 3), real_dim=0, (null)=0x000000016fdfe535, self_sizes= Has Value=true ) at TensorIndexing.h:239:7 236 const at::Device& /*self_device*/, - 237 const c10::optional& self_sizes) { + 237 const std::optional& self_sizes) { 238 // See NOTE [nested tensor size for indexing] -> 239 if (self_sizes.has_value()) { 240 auto maybe_index = index.maybe_as_int(); @@ -1081,10 +1081,6 @@ Here are a few well known pitfalls and workarounds: catch all of these problems: stay vigilant to the possibility that your crash is due to a real memory problem. -* (NVCC) `c10::optional` does not work when used from device code. Don't use - it from kernels. Upstream issue: https://github.com/akrzemi1/Optional/issues/58 - and our local issue #10329. - * `constexpr` generally works less well on MSVC. * The idiom `static_assert(f() == f())` to test if `f` is constexpr diff --git a/c10/core/StorageImpl.h b/c10/core/StorageImpl.h index 255a81855c4..1140ed97f93 100644 --- a/c10/core/StorageImpl.h +++ b/c10/core/StorageImpl.h @@ -23,7 +23,7 @@ C10_API void warnDeprecatedDataPtr(); // Currently used only for storing a custom error message // used when throwing an exception when data_ptr is accessed. struct C10_API StorageExtraMeta { - c10::optional custom_data_ptr_error_msg_ = c10::nullopt; + std::optional custom_data_ptr_error_msg_ = c10::nullopt; StorageExtraMeta() = default; StorageExtraMeta(const StorageExtraMeta& other) { if (other.custom_data_ptr_error_msg_) { @@ -283,7 +283,7 @@ struct C10_API StorageImpl : public c10::intrusive_ptr_target { [[noreturn]] void throw_data_ptr_access_error() const; void release_data_and_set_meta_custom_data_ptr_error_msg_( - c10::optional s) { + std::optional s) { throw_on_immutable_data_ptr_ = true; get_extra_meta().custom_data_ptr_error_msg_ = std::move(s); refresh_has_data_ptr_check();