mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Remove C10_DEPRECATED references in c10 (#151058)
Summary: Revive https://github.com/pytorch/pytorch/pull/138406. Only limit the scope to files in c10. Summary from the original PR, ``` Looking in the code I see // NB: __cplusplus doesn't work for MSVC, so for now MSVC always uses // the "__declspec(deprecated)" implementation and not the C++14 // "[[deprecated]]" attribute. We tried enabling "[[deprecated]]" for C++14 on // MSVC, but ran into issues with some older MSVC versions. But looking at the MSVC C++ support table I see that the [[deprecated]] attribute is supported as of MSVC 2015 and that the vast majority of C++17 features became supported in MSVC 2015 or later. Since PyTorch is C++17 now, I infer that PyTorch must not support versions of MSVC earlier than MSVC 2015, so the versions of MSVC supported by PyTorch must support [[deprecated]]. Therefore, since we are finished deprecating old MSVCs we can deprecate C10_DEPRECATED. ``` Test Plan: CI Differential Revision: D72762767 Pull Request resolved: https://github.com/pytorch/pytorch/pull/151058 Approved by: https://github.com/r-barnes
This commit is contained in:
committed by
PyTorch MergeBot
parent
d632cf2cc9
commit
dd1b6621bc
@ -3,6 +3,7 @@
|
||||
#include <ATen/core/CachingHostAllocator.h>
|
||||
#include <c10/core/Allocator.h>
|
||||
#include <c10/cuda/CUDAStream.h>
|
||||
#include <c10/util/Deprecated.h>
|
||||
|
||||
namespace at::cuda {
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include <ATen/core/CachingHostAllocator.h>
|
||||
#include <ATen/xpu/XPUEvent.h>
|
||||
#include <c10/core/Allocator.h>
|
||||
#include <c10/util/Deprecated.h>
|
||||
#include <c10/xpu/XPUStream.h>
|
||||
|
||||
namespace at::xpu {
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include <c10/core/SymNodeImpl.h>
|
||||
#include <c10/macros/Export.h>
|
||||
#include <c10/macros/Macros.h>
|
||||
#include <c10/util/Deprecated.h>
|
||||
#include <c10/util/Exception.h>
|
||||
#include <c10/util/Half.h>
|
||||
#include <c10/util/TypeCast.h>
|
||||
@ -187,9 +186,9 @@ class C10_API Scalar {
|
||||
return Tag::HAS_d == tag || Tag::HAS_sd == tag;
|
||||
}
|
||||
|
||||
C10_DEPRECATED_MESSAGE(
|
||||
"isIntegral is deprecated. Please use the overload with 'includeBool' parameter instead.")
|
||||
bool isIntegral() const {
|
||||
[[deprecated(
|
||||
"isIntegral is deprecated. Please use the overload with 'includeBool' parameter instead.")]] bool
|
||||
isIntegral() const {
|
||||
return Tag::HAS_i == tag || Tag::HAS_si == tag || Tag::HAS_u == tag;
|
||||
}
|
||||
bool isIntegral(bool includeBool) const {
|
||||
|
@ -1,7 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <c10/util/BFloat16.h>
|
||||
#include <c10/util/Deprecated.h>
|
||||
#include <c10/util/Exception.h>
|
||||
#include <c10/util/Float4_e2m1fn_x2.h>
|
||||
#include <c10/util/Float8_e4m3fn.h>
|
||||
@ -376,9 +375,9 @@ inline bool isIntegralType(ScalarType t, bool includeBool) {
|
||||
return isIntegral || (includeBool && t == ScalarType::Bool);
|
||||
}
|
||||
|
||||
C10_DEPRECATED_MESSAGE(
|
||||
"isIntegralType is deprecated. Please use the overload with 'includeBool' parameter instead.")
|
||||
inline bool isIntegralType(ScalarType t) {
|
||||
[[deprecated(
|
||||
"isIntegralType is deprecated. Please use the overload with 'includeBool' parameter instead.")]] inline bool
|
||||
isIntegralType(ScalarType t) {
|
||||
return isIntegralType(t, /*includeBool=*/false);
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <c10/macros/Macros.h>
|
||||
#include <c10/util/Deprecated.h>
|
||||
#include <c10/util/Exception.h>
|
||||
#include <c10/util/SmallVector.h>
|
||||
|
||||
@ -377,8 +376,8 @@ bool operator!=(c10::ArrayRef<T> a1, const std::vector<T>& a2) {
|
||||
|
||||
using IntArrayRef = ArrayRef<int64_t>;
|
||||
|
||||
// This alias is deprecated because it doesn't make ownership
|
||||
// semantics obvious. Use IntArrayRef instead!
|
||||
C10_DEFINE_DEPRECATED_USING(IntList, ArrayRef<int64_t>)
|
||||
using IntList [[deprecated(
|
||||
"This alias is deprecated because it doesn't make ownership semantics obvious. Use IntArrayRef instead!")]] =
|
||||
ArrayRef<int64_t>;
|
||||
|
||||
} // namespace c10
|
||||
|
@ -718,28 +718,28 @@ namespace c10::detail {
|
||||
|
||||
/*
|
||||
// Deprecation disabled until we fix sites in our codebase
|
||||
C10_DEPRECATED_MESSAGE("AT_ERROR(msg) is deprecated, use TORCH_CHECK(false, msg)
|
||||
instead.")
|
||||
[[deprecated("AT_ERROR(msg) is deprecated, use TORCH_CHECK(false, msg)
|
||||
instead.")]]
|
||||
*/
|
||||
inline void deprecated_AT_ERROR() {}
|
||||
|
||||
/*
|
||||
// Deprecation disabled until we fix sites in our codebase
|
||||
C10_DEPRECATED_MESSAGE("AT_ASSERT is deprecated, if you mean to indicate an
|
||||
[[deprecated("AT_ASSERT is deprecated, if you mean to indicate an
|
||||
internal invariant failure, use " \
|
||||
"TORCH_INTERNAL_ASSERT instead; if you mean to do user
|
||||
error checking, use " \ "TORCH_CHECK. See
|
||||
https://github.com/pytorch/pytorch/issues/20287 for more details.")
|
||||
https://github.com/pytorch/pytorch/issues/20287 for more details.")]]
|
||||
*/
|
||||
inline void deprecated_AT_ASSERT() {}
|
||||
|
||||
/*
|
||||
// Deprecation disabled until we fix sites in our codebase
|
||||
C10_DEPRECATED_MESSAGE("AT_ASSERTM is deprecated, if you mean to indicate an
|
||||
[[deprecated("AT_ASSERTM is deprecated, if you mean to indicate an
|
||||
internal invariant failure, use " \
|
||||
"TORCH_INTERNAL_ASSERT instead; if you mean to do user
|
||||
error checking, use " \ "TORCH_CHECK. See
|
||||
https://github.com/pytorch/pytorch/issues/20287 for more details.")
|
||||
https://github.com/pytorch/pytorch/issues/20287 for more details.")]]
|
||||
*/
|
||||
inline void deprecated_AT_ASSERTM() {}
|
||||
|
||||
|
Reference in New Issue
Block a user