diff --git a/onnxruntime/core/providers/cpu/tensor/upsample_antialias.h b/onnxruntime/core/providers/cpu/tensor/upsample_antialias.h index e5e641e96f7af..59b512def619d 100644 --- a/onnxruntime/core/providers/cpu/tensor/upsample_antialias.h +++ b/onnxruntime/core/providers/cpu/tensor/upsample_antialias.h @@ -414,7 +414,8 @@ void ComputeInterpolationAtLevel2(int64_t num_channels, int64_t input_height, in static_cast(output_height * 2), [&](std::ptrdiff_t first, std::ptrdiff_t last) { if (output_height == input_height) { - std::copy_n(Xdata_span.begin() + narrow(first * input_width), narrow((last - first) * output_width), + auto workload_in_thread = narrow(last) - narrow(first); + std::copy_n(Xdata_span.begin() + narrow(first * input_width), narrow(workload_in_thread * output_width), Ydata_span.begin() + narrow(first * output_width)); return; }