From 0ed30dbf026b89f6f3b4d5328e436f125de69169 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Thu, 20 Jun 2024 17:16:19 -0700 Subject: [PATCH 1/2] Remove redandunt code --- onnxruntime/core/providers/cuda/tensor/upsample.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/onnxruntime/core/providers/cuda/tensor/upsample.cc b/onnxruntime/core/providers/cuda/tensor/upsample.cc index 17533eb3d9a72..fafe6e685cd40 100644 --- a/onnxruntime/core/providers/cuda/tensor/upsample.cc +++ b/onnxruntime/core/providers/cuda/tensor/upsample.cc @@ -230,7 +230,7 @@ Status Upsample::BaseCompute(OpKernelContext* context, } const bool is_2D = X_dims.size() == 2; - const bool is_nchw = is_2D ? true : (scales[1] == 1.0f && scales[1] == 1.0f); + const bool is_nchw = is_2D ? true : scales[1] == 1.0f; ORT_RETURN_IF_NOT(is_nchw, "Resize 'Cubic' mode only supports NCWH layout " From cdf0d6210261b15ebce33de4e57a88c98e06c9e2 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Fri, 21 Jun 2024 10:44:18 -0700 Subject: [PATCH 2/2] Fix the bug --- onnxruntime/core/providers/cuda/tensor/upsample.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/onnxruntime/core/providers/cuda/tensor/upsample.cc b/onnxruntime/core/providers/cuda/tensor/upsample.cc index fafe6e685cd40..cbf745d3c7b4f 100644 --- a/onnxruntime/core/providers/cuda/tensor/upsample.cc +++ b/onnxruntime/core/providers/cuda/tensor/upsample.cc @@ -230,7 +230,7 @@ Status Upsample::BaseCompute(OpKernelContext* context, } const bool is_2D = X_dims.size() == 2; - const bool is_nchw = is_2D ? true : scales[1] == 1.0f; + const bool is_nchw = is_2D ? true : (scales[0] == 1.0f && scales[1] == 1.0f); ORT_RETURN_IF_NOT(is_nchw, "Resize 'Cubic' mode only supports NCWH layout "