From b0d5945e649590eca6c6535ea579be9d0a6d59a4 Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Sat, 14 Dec 2024 10:51:43 -0800 Subject: [PATCH] fix macos ci errors --- .../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 75161d2c9eb1b..5b192eda4c99e 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 (int i = 0; i < starts_raw.size(); i++) { + for (auto 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 (int i = 0; i < ends_raw.size(); i++) { + for (auto 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 (int i = 0; i < axes_raw.size(); i++) { + for (auto 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 (int i = 0; i < steps_raw.size(); i++) { + for (auto 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++) { - int idx = -1; - for (int j = 0; j < axes_raw.size(); j++) { + auto idx = -1; + for (auto 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 (int i = 0; i < steps_tmp.size(); i++) { + for (auto 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 (int i = 0; i < steps_tmp.size(); i++) { + for (auto 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 (int i = 0; i < steps_tmp.size(); i++) { + for (auto i = 0; i < steps_tmp.size(); i++) { steps.push_back(static_cast(steps_tmp[i])); } // calculate output dims std::vector output_dims; - for (int i = 0; i < axes.size(); i++) { + for (auto 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)