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

@ -36,8 +36,8 @@
#include <c10/cuda/CUDAStream.h>
#endif
#include <c10/util/Exception.h>
#include <c10/util/Optional.h>
#include <c10/util/irange.h>
#include <optional>
#include <algorithm>
#include <cstddef>
@ -62,7 +62,7 @@ void clear_registered_instances(void* ptr);
TORCH_PYTHON_API IValue toIValue(
py::handle obj,
const TypePtr& type,
std::optional<int32_t> N = std::nullopt);
std::optional<int32_t> N = c10::nullopt);
TORCH_PYTHON_API py::object toPyObject(IValue ivalue);
@ -111,7 +111,7 @@ struct VISIBILITY_HIDDEN PythonFutureWrapper
explicit PythonFutureWrapper(
c10::intrusive_ptr<c10::ivalue::Future> fut,
std::optional<UnwrapFunc> unwrap_func = std::nullopt)
std::optional<UnwrapFunc> unwrap_func = c10::nullopt)
: fut(std::move(fut)), unwrap_func(std::move(unwrap_func)) {}
explicit PythonFutureWrapper(const PythonFutureWrapper&) = delete;
@ -1205,7 +1205,7 @@ inline std::optional<py::object> maybeTorchFunctionDispatch(
/*module_name=*/qualname.prefix().c_str()));
}
return std::nullopt;
return c10::nullopt;
}
inline py::object invokeScriptFunctionFromPython(
@ -1219,7 +1219,7 @@ inline py::object invokeScriptFunctionFromPython(
callee,
args,
kwargs,
/*self=*/std::nullopt,
/*self=*/c10::nullopt,
[&](Graph& graph, const MatchedSchema& match) {
return graph.insertFunctionCall(&callee, match);
});
@ -1255,7 +1255,7 @@ TORCH_PYTHON_API py::object invokeOperatorFromPython(
const std::vector<std::shared_ptr<Operator>>& operations,
py::args args,
const py::kwargs& kwargs,
std::optional<c10::DispatchKey> dk = std::nullopt);
std::optional<c10::DispatchKey> dk = c10::nullopt);
TORCH_PYTHON_API std::optional<py::object> _maybe_handle_torch_function(
const std::string& ns,
@ -1276,6 +1276,6 @@ TORCH_PYTHON_API py::object _get_operation_for_overload_or_packet(
py::args args,
const py::kwargs& kwargs,
bool is_overload,
std::optional<c10::DispatchKey> dk = std::nullopt);
std::optional<c10::DispatchKey> dk = c10::nullopt);
} // namespace torch::jit