Skip to content

Commit ce80865

Browse files
Revert "Replace is_same with is_same_v for concise syntax (pytorch#145450)"
This reverts commit 5205158. Reverted pytorch#145450 on behalf of https://github.com/jeanschmidt due to testing to see if reverting would fix timeout in inductor jobs ([comment](pytorch#145450 (comment)))
1 parent b004228 commit ce80865

File tree

6 files changed

+10
-10
lines changed

6 files changed

+10
-10
lines changed

aten/src/ATen/core/List_inl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ List<T>::List(TypePtr elementType)
4747
: List(make_intrusive<c10::detail::ListImpl>(
4848
typename c10::detail::ListImpl::list_type(),
4949
std::move(elementType))) {
50-
static_assert(std::is_same_v<T, IValue> || std::is_same_v<T, c10::intrusive_ptr<ivalue::Future>>,
50+
static_assert(std::is_same_v<T, IValue> || std::is_same<T, c10::intrusive_ptr<ivalue::Future>>::value,
5151
"This constructor is only valid for c10::impl::GenericList or List<Future>.");
5252
}
5353

aten/src/ATen/cpu/vec/vec256/zarch/vec256_zarch.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ constexpr bool is_zarch_implemented_quant() {
3838

3939
template <typename T>
4040
constexpr bool is_zarch_implemented_complex() {
41-
return std::is_same_v<T, c10::complex<float>> ||
42-
std::is_same_v<T, c10::complex<double>>;
41+
return std::is_same<T, c10::complex<float>>::value ||
42+
std::is_same<T, c10::complex<double>>::value;
4343
}
4444

4545
constexpr int offset0 = 0;

aten/src/ATen/cuda/cub.cuh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ constexpr int block_threads(){
478478

479479
template<typename scalar_t, typename ScanOpT>
480480
inline void inclusive_deterministic_scan(const scalar_t * input, scalar_t * output, ScanOpT scan_op, int64_t num_items) {
481-
static_assert(std::is_same_v<ScanOpT, std::plus<scalar_t>>, "");
481+
static_assert(std::is_same<ScanOpT, std::plus<scalar_t>>::value, "");
482482
constexpr int BLOCK_THREADS = block_threads<sizeof(scalar_t)>();
483483
constexpr int ITEMS_PER_THREAD = 16;
484484
auto grid_size = (num_items + BLOCK_THREADS * ITEMS_PER_THREAD - 1) / (BLOCK_THREADS * ITEMS_PER_THREAD);

aten/src/ATen/native/cuda/ScanUtils.cuh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ void scan_dim(const TensorBase& self, const TensorBase& result,
451451
TORCH_INTERNAL_ASSERT(result.is_contiguous());
452452
453453
if (self.numel() == self.size(dim)) {
454-
if constexpr (std::is_same_v<BinaryFunction, std::plus<scalar_t>>) {
454+
if constexpr (std::is_same<BinaryFunction, std::plus<scalar_t>>::value) {
455455
if (C10_UNLIKELY(at::globalContext().deterministicAlgorithms()) && (self.is_floating_point() || self.is_complex())) {
456456
# if (defined(CUDA_VERSION) && CUDA_VERSION > 11040) || defined(USE_ROCM)
457457
cuda::cub::inclusive_deterministic_scan(self_->const_data_ptr<scalar_t>(), result.mutable_data_ptr<scalar_t>(), binary_op, self.numel());

aten/src/ATen/native/sparse/cuda/SparseMatMul.cu

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,8 @@ struct CusparseMatrixMultiplyOp {
211211
std::is_same_v<c10::BFloat16, scalar_t> ||
212212
std::is_same_v<float, scalar_t> ||
213213
std::is_same_v<double, scalar_t> ||
214-
std::is_same_v<c10::complex<float>, scalar_t> ||
215-
std::is_same_v<c10::complex<double>, scalar_t>,
214+
std::is_same<c10::complex<float>, scalar_t>::value ||
215+
std::is_same<c10::complex<double>, scalar_t>::value,
216216
"cusparseSpGEMM only supports data type of half, bfloat16, float, double and complex float, double.");
217217
// SpGEMM Computation
218218
TORCH_CUDASPARSE_CHECK(cusparseSpGEMM_createDescr(&spgemmDesc));
@@ -673,8 +673,8 @@ void sparse_sparse_matmul_cuda_kernel(
673673
std::is_same_v<c10::BFloat16, scalar_t> ||
674674
std::is_same_v<float, scalar_t> ||
675675
std::is_same_v<double, scalar_t> ||
676-
std::is_same_v<c10::complex<float>, scalar_t> ||
677-
std::is_same_v<c10::complex<double>, scalar_t>,
676+
std::is_same<c10::complex<float>, scalar_t>::value ||
677+
std::is_same<c10::complex<double>, scalar_t>::value,
678678
"sparse_sparse_matmul_cuda_kernel only supports data type of half, bfloat16, float, double and complex float, double.");
679679

680680
// older versions of cusparse on Windows segfault for complex128 dtype

aten/src/ATen/templates/TensorBody.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ class TORCH_API Tensor: public TensorBase {
582582
template <typename T>
583583
using hook_return_void_t = std::enable_if_t<std::is_void<typename std::invoke_result_t<T&, Tensor>>::value, unsigned>;
584584
template <typename T>
585-
using hook_return_var_t = std::enable_if_t<std::is_same_v<typename std::invoke_result_t<T&, Tensor>, Tensor>, unsigned>;
585+
using hook_return_var_t = std::enable_if_t<std::is_same<typename std::invoke_result_t<T&, Tensor>, Tensor>::value, unsigned>;
586586

587587
/// Registers a backward hook.
588588
///

0 commit comments

Comments
 (0)