Skip to content

Promote ints in erf and sigmoid, and trace linspace bounds - #164

Merged
hertschuh merged 1 commit into
mainfrom
master-drift-1125
Nov 25, 2026
Merged

hertschuh merged 1 commit into
mainfrom
master-drift-1125

Conversation

@MarcosAsh

Copy link
Copy Markdown
Collaborator

keras-team/keras#24321, #24322 and #24344 broke five keras master tests on mlx, so main and every open PR are red.

erf, erfinv, rsqrt and sigmoid now promote int inputs to floatx, like the other backends do after those PRs.

The backend-agnostic histogram passes traced bounds to linspace, which read them with .item() and failed under mx.compile. linspace now computes mx.linspace's formula on arrays, so traced bounds work and both ends stay exact. That also fixes some older bugs. Int dtypes with array bounds returned zeros everywhere but the last row, and negative ints were truncated where numpy floors. A negative num raises again, and retstep gives nan below two samples like numpy. integration_tests/linspace_test.py covers these.

On keras master d0aece6d3 the linux suite passes. On Metal, compile on and off, the only failure is test_logspace, the 1 ulp drift from keras-team/keras#24305, and main fails it the same way.

@hertschuh hertschuh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the fix!

@hertschuh
hertschuh merged commit abc310e into main Nov 25, 2026
10 checks passed
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.

2 participants