Skip to content

Send unsupported inputs to the array path and widen the numba parity tests - #177

Merged
frazane merged 5 commits into
mainfrom
array-api/p4-parity-breadth
Nov 8, 2026
Merged

frazane merged 5 commits into
mainfrom
array-api/p4-parity-breadth

Conversation

@frazane

@frazane frazane commented Nov 8, 2026

Copy link
Copy Markdown
Owner

Part of the Phase 4 stack. Before numba becomes the default for numpy inputs, every input the array path accepts must either give the same result on the gufunc path or go to the array path. This adds that guard and closes the parity gaps found in the coverage review.

What changed

  • use_numba checks that every array reaching a gufunc is a plain numpy array or scalar (np.memmap included), a Python scalar or a list of a supported dtype. Masked arrays, np.matrix, objects with only __array__, complex, object, longdouble and float16 inputs take the array path, also with backend="numba". Extra arrays such as weights, alpha and the outputs of w_func go through the same check.
  • owcrps and vrcrps cast the w_func weights to the forecast dtype like owgksuv already did, so float32 data with a float64 w_func gives float32 on both paths (it was float64 on the array path).
  • assert_paths_agree also runs the default dispatch with the global numba switch on, and checks that the numba paths actually call a gufunc while the plain path does not.
  • New parity cases: float32, 0-d and numpy-scalar obs, multivariate nan cases, twcrps, the missing w_func and v_func variants, sorted ensembles, M=1, vs p and w variants, crps_quantile and WIS alpha variants, invalid estimators and nan_policy.
  • The dssmv array path returns a numpy scalar for a single sample, like the gufunc.

Notes

Two unsigned-integer cases are strict xfails for #176, which is a bug on the array path. The guard costs about 1 us per call.


This change was developed in tandem with AI coding agents.

@github-actions github-actions Bot added the core Core scoring API / numerics label Nov 8, 2026
@frazane
frazane merged commit b14dc69 into main Nov 8, 2026
27 checks passed
@frazane
frazane deleted the array-api/p4-parity-breadth branch November 8, 2026 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Core scoring API / numerics

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant