mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
[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:
committed by
PyTorch MergeBot
parent
b55f57b7af
commit
ed327876f5
@ -149,9 +149,9 @@ struct SchemaParser {
|
||||
auto fake_type = std::move(std::get<0>(p));
|
||||
auto real_type = std::move(std::get<1>(p));
|
||||
auto alias_info = std::move(std::get<2>(p));
|
||||
c10::optional<int32_t> N;
|
||||
c10::optional<IValue> default_value;
|
||||
c10::optional<std::string> alias_set;
|
||||
std::optional<int32_t> N;
|
||||
std::optional<IValue> default_value;
|
||||
std::optional<std::string> alias_set;
|
||||
std::string name;
|
||||
if (L.nextIf('[')) {
|
||||
// note: an array with a size hint can only occur at the Argument level
|
||||
@ -162,7 +162,7 @@ struct SchemaParser {
|
||||
auto container = type_parser.parseAliasAnnotation();
|
||||
if (alias_info) {
|
||||
if (!container) {
|
||||
container = c10::optional<at::AliasInfo>(at::AliasInfo());
|
||||
container = std::optional<at::AliasInfo>(at::AliasInfo());
|
||||
container->setIsWrite(alias_info->isWrite());
|
||||
}
|
||||
container->addContainedType(std::move(*alias_info));
|
||||
@ -297,7 +297,7 @@ struct SchemaParser {
|
||||
IValue parseDefaultValue(
|
||||
const c10::Type& arg_type,
|
||||
TypeKind kind,
|
||||
c10::optional<int32_t> arg_N) {
|
||||
std::optional<int32_t> arg_N) {
|
||||
auto range = L.cur().range;
|
||||
switch (kind) {
|
||||
case TypeKind::TensorType:
|
||||
|
Reference in New Issue
Block a user