MLX compatibility: Statistical functions

Open
#463 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
68/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
python
Domain
tooling

Research direction

Start by running the named tests: test_cumulative_sum, test_cumulative_prod, test_prod, test_std, test_sum, and test_var. Trace their failures through the Python compatibility layer and compare each wrapper with the Array API signatures and dtype rules shown here. Done means the keyword mismatches and small-integer promotion cases pass for all six statistical functions.

Written by the indexing model from the issue text.

Description

Array API MLX Analog Status Notes Test Node Result
cumulative_sum(x, /, *, axis=None, dtype=None, include_initial=False) cumsum(a, /, axis: int | None = None, *, reverse: bool = False, inclusive: bool = True, dtype: Dtype | None = None, stream=None) incompatible MLX lacks the include_initial keyword (raises TypeError) and skips the standard default-integer dtype promotion — a uint8 input stays uint8 instead of promoting to uint32. test_cumulative_sum Failed
cumulative_prod(x, /, *, axis=None, dtype=None, include_initial=False) cumprod(a, /, axis: int | None = None, *, reverse: bool = False, inclusive: bool = True, dtype: Dtype | None = None, stream=None) incompatible Same two issues as cumulative_sum: missing include_initial keyword and no default-integer dtype promotion (uint8 stays uint8 instead of uint32). test_cumulative_prod Failed
prod(x, /, *, axis=None, dtype=None, keepdims=False) prod(a, /, axis: None | int | Sequence[int] = None, keepdims: bool = False, *, stream=None) incompatible MLX has no dtype keyword (raises TypeError) and does not promote small integer inputs to the standard default integer dtype (uint8 stays uint8 instead of uint32). test_prod Failed
std(x, /, *, axis=None, correction=0.0, keepdims=False) std(a, /, axis: None | int | Sequence[int] = None, keepdims: bool = False, ddof: int = 0, *, stream=None) incompatible MLX exposes ddof instead of the Array API's correction keyword, so passing correction raises a TypeError. test_std Failed
sum(x, /, *, axis=None, dtype=None, keepdims=False) sum(a, /, axis: None | int | Sequence[int] = None, keepdims: bool = False, *, stream=None) incompatible MLX has no dtype keyword (raises TypeError) and does not promote small integer inputs to the standard default integer dtype (uint8 stays uint8 instead of uint32). test_sum Failed
var(x, /, *, axis=None, correction=0.0, keepdims=False) var(a, /, axis: None | int | Sequence[int] = None, keepdims: bool = False, ddof: int = 0, *, stream=None) incompatible MLX exposes ddof instead of the Array API's correction keyword, so passing correction raises a TypeError. test_var Failed
Dominant language
Python
Stars
131
Forks
49
Avg merge
2d 8h
Merged PRs (30d)
6

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from data-apis/array-api-compat

All issues in data-apis/array-api-compat

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.