File pytorch-fix-stdcxx14-error-__glibcxx_assert_fail.patch of Package python-torch-oldstable

diff --git a/aten/src/ATen/native/cuda/IndexKernel.cu b/aten/src/ATen/native/cuda/IndexKernel.cu
index 5682ba275..320004eca 100644
--- a/aten/src/ATen/native/cuda/IndexKernel.cu
+++ b/aten/src/ATen/native/cuda/IndexKernel.cu
@@ -249,7 +249,8 @@ void index_put_kernel_quantized_cuda(TensorIterator& iter, const IntArrayRef ind
 
     gpu_index_kernel(iter, index_size, index_stride, [inv_scale, zero_point, qmin, qmax]C10_DEVICE(char* const out_data, const char* const in_data, const int64_t offset) {
       int64_t qvalue = static_cast<int64_t>(zero_point + nearbyintf(*(float*)in_data * inv_scale));
-      qvalue = std::clamp(qvalue, qmin, qmax);
+      int64_t new_max = std::max<int64_t>(qmin, qvalue);
+      qvalue = std::min<int64_t>(qmax, new_max);
       *(scalar_t*)(out_data + offset) = static_cast<scalar_t>(qvalue);
     });
   });
openSUSE Build Service is sponsored by