From a3963d215848a61b50a52f0bce81f9799f54ba2c Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Sat, 14 Dec 2024 15:18:47 -0800 Subject: [PATCH] fix macos ci errors 2 --- .../core/providers/webgpu/tensor/slice.cc | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/onnxruntime/core/providers/webgpu/tensor/slice.cc b/onnxruntime/core/providers/webgpu/tensor/slice.cc index 5b192eda4c99e..d510bf7da808a 100644 --- a/onnxruntime/core/providers/webgpu/tensor/slice.cc +++ b/onnxruntime/core/providers/webgpu/tensor/slice.cc @@ -122,7 +122,7 @@ Status Slice::ComputeInternal(ComputeContext& context) const { // PROCESS INPUTS std::vector starts; - for (auto i = 0; i < starts_raw.size(); i++) { + for (unsigned int i = 0; i < starts_raw.size(); i++) { int64_t val = starts_raw[i]; if (val < 0) { val += input_shape[axes_raw[i]]; @@ -136,7 +136,7 @@ Status Slice::ComputeInternal(ComputeContext& context) const { } std::vector ends; - for (auto i = 0; i < ends_raw.size(); i++) { + for (unsigned int i = 0; i < ends_raw.size(); i++) { int64_t val = ends_raw[i]; if (val < 0) { val += input_shape[axes_raw[i]]; @@ -150,20 +150,20 @@ Status Slice::ComputeInternal(ComputeContext& context) const { } std::vector axes; - for (auto i = 0; i < axes_raw.size(); i++) { + for (unsigned int i = 0; i < axes_raw.size(); i++) { axes.push_back(static_cast(axes_raw[i])); } // temporary steps vector to handle negative steps std::vector steps_tmp; - for (auto i = 0; i < steps_raw.size(); i++) { + for (unsigned int i = 0; i < steps_raw.size(); i++) { steps_tmp.push_back(static_cast(steps_raw[i])); } if (static_cast(axes.size()) != input_rank) { for (uint32_t i = 0; i < input_rank; i++) { - auto idx = -1; - for (auto j = 0; j < axes_raw.size(); j++) { + int idx = -1; + for (unsigned int j = 0; j < axes_raw.size(); j++) { if (axes_raw[j] == i) { idx = j; break; @@ -180,12 +180,12 @@ Status Slice::ComputeInternal(ComputeContext& context) const { // retain the sign of the steps std::vector signs; - for (auto i = 0; i < steps_tmp.size(); i++) { + for (unsigned int i = 0; i < steps_tmp.size(); i++) { signs.push_back(steps_tmp[i] < 0 ? -1 : (steps_tmp[i] > 0 ? 1 : 0)); } // Convert negative steps to positive steps and reverse starts and ends - for (auto i = 0; i < steps_tmp.size(); i++) { + for (unsigned int i = 0; i < steps_tmp.size(); i++) { if (steps_tmp[i] < 0) { float numSteps = static_cast((static_cast(ends[i]) - static_cast(starts[i])) / static_cast(steps_tmp[i])); float newEnd = static_cast(starts[i]); @@ -199,13 +199,13 @@ Status Slice::ComputeInternal(ComputeContext& context) const { // final steps vector of type unsigned int std::vector steps; - for (auto i = 0; i < steps_tmp.size(); i++) { + for (unsigned int i = 0; i < steps_tmp.size(); i++) { steps.push_back(static_cast(steps_tmp[i])); } // calculate output dims std::vector output_dims; - for (auto i = 0; i < axes.size(); i++) { + for (unsigned int i = 0; i < axes.size(); i++) { int32_t dim = axes[i]; float tmp = ceil((static_cast(ends[dim]) - static_cast(starts[dim])) / static_cast(steps[dim])); if (tmp < 0)