Skip to content

Conversation

crusaderky
Copy link
Contributor

@crusaderky crusaderky commented Mar 5, 2025

  • Add Array API support for scipy.special.softmax and scipy.special.log_softmax, including no-compute Dask and jax.jit
  • Refactor unit tests of log_softmax to bring them in line with all other tests
  • Test logsumexp and _wrap_radians under no-compute Dask and jax.jit

@github-actions github-actions bot added scipy.special Meson Items related to the introduction of Meson as the new build system for SciPy enhancement A new feature or improvement labels Mar 5, 2025
Comment on lines 403 to +406
# suppress warnings about log of zero
with np.errstate(divide='ignore'):
s = np.sum(exp_tmp, axis=axis, keepdims=True)
out = np.log(s)
s = xp.sum(exp_tmp, axis=axis, keepdims=True)
out = xp.log(s)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In order to suppress warnings on dask, we would need to replace this with xpx.apply_where

@lucascolley lucascolley added array types Items related to array API support and input array validation (see gh-18286) and removed Meson Items related to the introduction of Meson as the new build system for SciPy labels Mar 5, 2025
@lucascolley lucascolley added this to the 1.16.0 milestone Mar 5, 2025
Copy link
Member

@j-bowhay j-bowhay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, changes are pretty minimal

@j-bowhay j-bowhay merged commit 50a007e into scipy:main Mar 6, 2025
39 of 40 checks passed
@crusaderky crusaderky deleted the softmax branch March 6, 2025 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
array types Items related to array API support and input array validation (see gh-18286) enhancement A new feature or improvement scipy.special
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants