Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit dbd6ada

Browse files
r-barnespytorchmergebot
authored andcommitted
Clean up a c10::optional and fix documentation (pytorch#138700)
Fixes #ISSUE_NUMBER Pull Request resolved: pytorch#138700 Approved by: https://github.com/Skylion007
1 parent 8aedc64 commit dbd6ada

2 files changed

Lines changed: 3 additions & 7 deletions

File tree

CONTRIBUTING.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,7 @@ Process 87741 stopped
878878
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
879879
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
880880
236 const at::Device& /*self_device*/,
881-
237 const c10::optional<SymIntArrayRef>& self_sizes) {
881+
237 const std::optional<SymIntArrayRef>& self_sizes) {
882882
238 // See NOTE [nested tensor size for indexing]
883883
-> 239 if (self_sizes.has_value()) {
884884
240 auto maybe_index = index.maybe_as_int();
@@ -1081,10 +1081,6 @@ Here are a few well known pitfalls and workarounds:
10811081
catch all of these problems: stay vigilant to the possibility that
10821082
your crash is due to a real memory problem.
10831083
1084-
* (NVCC) `c10::optional` does not work when used from device code. Don't use
1085-
it from kernels. Upstream issue: https://github.com/akrzemi1/Optional/issues/58
1086-
and our local issue #10329.
1087-
10881084
* `constexpr` generally works less well on MSVC.
10891085
10901086
* The idiom `static_assert(f() == f())` to test if `f` is constexpr

c10/core/StorageImpl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ C10_API void warnDeprecatedDataPtr();
2323
// Currently used only for storing a custom error message
2424
// used when throwing an exception when data_ptr is accessed.
2525
struct C10_API StorageExtraMeta {
26-
c10::optional<std::string> custom_data_ptr_error_msg_ = c10::nullopt;
26+
std::optional<std::string> custom_data_ptr_error_msg_ = c10::nullopt;
2727
StorageExtraMeta() = default;
2828
StorageExtraMeta(const StorageExtraMeta& other) {
2929
if (other.custom_data_ptr_error_msg_) {
@@ -283,7 +283,7 @@ struct C10_API StorageImpl : public c10::intrusive_ptr_target {
283283
[[noreturn]] void throw_data_ptr_access_error() const;
284284

285285
void release_data_and_set_meta_custom_data_ptr_error_msg_(
286-
c10::optional<std::string> s) {
286+
std::optional<std::string> s) {
287287
throw_on_immutable_data_ptr_ = true;
288288
get_extra_meta().custom_data_ptr_error_msg_ = std::move(s);
289289
refresh_has_data_ptr_check();

0 commit comments

Comments
 (0)