Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ This release is compatible with NumPy 2.5.
* Fixed `icx`/`icpx` warning during `conda build` by stripping the GCC-only `-fno-merge-constants` flag injected by conda-forge into `CFLAGS`/`CXXFLAGS` [#2978](https://github.com/IntelPython/dpnp/pull/2978)
* Fixed `dpnp.asnumpy` and `dpnp.ndarray.asnumpy` ignoring the `order` keyword, which caused a non-contiguous source array to be returned with a non-contiguous layout even when `order="C"` was requested [#2980](https://github.com/IntelPython/dpnp/pull/2980)
* Fixed `dpnp.tensor.acosh` and `dpnp.tensor.acos` returning infinity for complex numbers with large negative real parts [#2928](https://github.com/IntelPython/dpnp/pull/2928)
* Fixed `dpnp.interp` returning `nan` when querying at an exact knot point whose adjacent `fp` value is `inf` [#2985](https://github.com/IntelPython/dpnp/pull/2985)

### Security

Expand Down
3 changes: 3 additions & 0 deletions dpnp/backend/kernels/elementwise_functions/interpolate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ class InterpolateFunctor
else if (x_idx >= static_cast<TIdx>(xp_size - 1)) {
out[id] = right_val;
}
else if (x_val == xp[x_idx]) {
out[id] = fp[x_idx];
}
else {
TValue slope =
(fp[x_idx + 1] - fp[x_idx]) / (xp[x_idx + 1] - xp[x_idx]);
Expand Down
12 changes: 12 additions & 0 deletions dpnp/tests/third_party/cupy/math_tests/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,18 @@ def test_interp_inf_to_nan(self, xp, dtype_y, dtype_x):
fy = xp.asarray([0, 10], dtype=dtype_y)
return xp.interp(x, fx, fy)

@testing.for_float_dtypes(name="dtype_x")
@testing.for_dtypes("efdFD", name="dtype_y")
@testing.numpy_cupy_allclose(atol=1e-5, type_check=has_support_aspect64())
def test_interp_inf_fy_at_knot(self, xp, dtype_y, dtype_x):
# Regression test: querying at an exact knot point should return the
# knot value, not nan, even when the adjacent fy value is inf.
# See https://github.com/cupy/cupy/issues/9823
x = xp.asarray([2.0], dtype=dtype_x)
fx = xp.asarray([1.0, 2.0, 3.0, 4.0], dtype=dtype_x)
fy = xp.asarray([1.0, 2.0, xp.inf, 4.0], dtype=dtype_y)
return xp.interp(x, fx, fy)

@testing.for_all_dtypes(name="dtype_2", no_bool=True, no_complex=True)
@testing.for_all_dtypes(name="dtype_1", no_bool=True, no_complex=True)
@testing.numpy_cupy_array_equal(type_check=has_support_aspect64())
Expand Down
Loading