Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

c10::optional -> std::optional #473

Merged
merged 1 commit into from
Jan 10, 2025
Merged

c10::optional -> std::optional #473

merged 1 commit into from
Jan 10, 2025

Conversation

r-barnes
Copy link
Contributor

@r-barnes r-barnes commented Jan 9, 2025

Since Nov 29, 2023, PyTorch's c10::optional has been an alias for std::optional (link).

As of Dec 17, 2024, PyTorch has begun taking steps to begin removing the c10::optional alias entirely (link). The old API remains available, for now, but you can check whether your code has eliminated all instances of deprecated APIs by compiling with C10_NODEPRECATED defined as a preprocessor flag (-DC10_NODEPRECATED).

This PR converts your existing usages of c10::optional to std::optional (same for nullopt).

(Additional deprecated APIs include C10_UNUSED, C10_NODISCARD, and c10::string_view.)

@codecov-commenter
Copy link

codecov-commenter commented Jan 9, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.20%. Comparing base (140d3ad) to head (82f34d0).
Report is 10 commits behind head on master.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #473      +/-   ##
==========================================
+ Coverage   97.23%   98.20%   +0.97%     
==========================================
  Files          10       10              
  Lines         217      223       +6     
==========================================
+ Hits          211      219       +8     
+ Misses          6        4       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rusty1s rusty1s merged commit 7126aeb into rusty1s:master Jan 10, 2025
5 checks passed
@guanshaoheng
Copy link
Contributor

guanshaoheng commented Jan 14, 2025

when compiling on Windows in github action, I was told

D:\a\PretextView\PretextView\subprojects\pytorch_scatter\csrc\cpu\segment_coo_cpu.h(5,32): error C2039: 'optional': is not a member of 'std' [D:\a\PretextView\PretextView\subprojects\pytorch_scatter\build\torchscatter.vcxproj]
(compiling source file '../csrc/cpu/segment_coo_cpu.cpp')
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.42.34433\include\forward_list(23,1):

For details, please check here.

any idea how to solve this?

I am using the newest libtorch for Windows.

Thanks for your help.

Best
Shaoheng

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants