Fix round_prefer_ceil nearest mode for negative halfway values in Resize op (#28345)
### Description
`ROUND_PREFER_CEIL` in the Resize operator used bare
`std::round`/`roundf`, which rounds away from zero. This is correct for
positive halfway values (e.g., `round(0.5) = 1 = ceil(0.5)`) but wrong
for negative halfway values (e.g., `round(-0.5) = -1`, but `ceil(-0.5) =
0`).
Negative coordinates occur naturally with the `half_pixel` coordinate
transformation mode for the first output pixels when upsampling.
Added an explicit negative-halfway check, mirroring the existing
positive-halfway check in `ROUND_PREFER_FLOOR`:
```cpp
// CPU (upsamplebase.h)
case ROUND_PREFER_CEIL:
return [](float x_original, bool) {
if (x_original == static_cast<int64_t>(x_original) - 0.5f) {
return static_cast<int64_t>(std::ceil(x_original));
}
return static_cast<int64_t>(std::round(x_original));
};
```
Same fix applied to the CUDA implementation (`resize_impl.cu`).
Added two test cases in `resize_op_test.cc`:
1. `ResizeOpNearestUpSample_RoundPreferCeil_HalfPixel` — exercises
non-integer scale (26→64) from the original issue report, verifying
correct source pixel selection at fractional boundaries.
2. `ResizeOpNearestUpSample_RoundPreferCeil_HalfPixel_2x2to7x8` —
exercises a positive 0.5 boundary where `round_prefer_ceil` selects
ceiling.
### Motivation and Context
The `round_prefer_floor` path already had an explicit halfway-case
override (for positive values where `std::round` disagrees with floor).
The `round_prefer_ceil` path was missing the symmetric fix for negative
values, violating the ONNX spec semantics of "at ties, prefer ceiling."
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: tianleiwu <30328909+tianleiwu@users.noreply.github.com>
Co-authored-by: Tianlei Wu <tlwu@microsoft.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>