Skip to content

Support axis-aware any and all reductions - #2967

Open
Sinkleberg wants to merge 1 commit into
xtensor-stack:masterfrom
Sinkleberg:codex/axis-logical-reductions
Open

Sinkleberg wants to merge 1 commit into
xtensor-stack:masterfrom
Sinkleberg:codex/axis-logical-reductions

Conversation

@Sinkleberg

Copy link
Copy Markdown

Checklist

  • The title and commit message describe the change.
  • The changes are in one commit.
  • Regression tests cover the new overloads.
  • The overloads are documented.

Description

Adds axis arguments to xt::any and xt::all, including negative axes, multiple axes, and keep_dims. Calls without an axis keep their scalar result and short-circuit behavior.

The tests also cover empty reductions. For example, reducing a 0 × 3 array over axis 0 produces three false values for any and three true values for all, including with immediate evaluation.

The full xtest target passed. All 73 math tests passed with SIMD enabled and disabled.

Fixes #1555.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

any() and all() should support axis and keep_dims

1 participant