Revert "[1/N] Change #include <c10/util/Optional.h> to #include <optional> (#128301)"

This reverts commit bd72e28314d8d63bb347becb8309f5ac7761c6b5.

Reverted https://github.com/pytorch/pytorch/pull/128301 on behalf of https://github.com/huydhn due to Sorry for reverting your change but it fails XLA build bd72e28314. Please rebase your PR before relanding because I think the failure is hidden by an unrelated broken trunk XLA failure from your current base commit ([comment](https://github.com/pytorch/pytorch/pull/128301#issuecomment-2169035822))
This commit is contained in:
PyTorch MergeBot
2024-06-15 01:58:20 +00:00
parent 5efe71f134
commit 846bb30e13
330 changed files with 1207 additions and 1208 deletions

View File

@ -320,7 +320,7 @@ std::pair<std::shared_ptr<Graph>, std::optional<Module>> PrepareForStaticModule(
const StaticModuleOptions& opts,
std::vector<IValue> sample_inputs) {
PrepareGraphForStaticModule(graph, opts, std::move(sample_inputs));
return std::make_pair(graph, std::nullopt);
return std::make_pair(graph, c10::nullopt);
}
} // namespace
@ -573,7 +573,7 @@ StaticModule::StaticModule(
const auto num_schema_args = schema_->arguments().size();
DCHECK(num_schema_args > 0);
if (removeSelfFromGraphInput(graph_)) {
module_ = std::nullopt;
module_ = c10::nullopt;
num_inputs_ = num_schema_args - 1;
}
}
@ -1251,7 +1251,7 @@ bool BlockRunner::fast_check_and_correct_overlap_with(
auto& tensor = tensor_ival.toTensor();
if (planner_->overlapWithInternalBuffer(tensor.data_ptr())) {
DLOG(INFO) << "Detected alias for node: " << PrintNode(n.node());
tensor_ival = at::native::clone(tensor, std::nullopt);
tensor_ival = at::native::clone(tensor, c10::nullopt);
n.set_outputs_memory_overlap_detected();
return true;
}
@ -2218,7 +2218,7 @@ bool ProcessedNode::check_and_correct_overlap_with(
auto& tensor = output_ival.toTensor();
if (!checkNoMemoryOverlap(input, tensor)) {
DLOG(INFO) << "Detected alias for node: " << PrintNode(node());
output_ival = at::native::clone(tensor, std::nullopt);
output_ival = at::native::clone(tensor, c10::nullopt);
set_outputs_memory_overlap_detected();
return true;
}