Regression from #3475. Noticed it while prepping for an interview:) This returns 140 on CPU and Metal instead of the expected 152.
import mlx.core as mx
x = mx.arange(16, dtype=mx.float32) ** 2
y = mx.as_strided(x, (2, 2, 2), (1, 1, 5))
print(mx.sum(y).item())
The element count equals the memory span, but the view has overlaps and gaps. It is incorrectly marked contiguous, so the reduction sums addresses 0–7.
Regression from #3475. Noticed it while prepping for an interview:) This returns
140on CPU and Metal instead of the expected152.The element count equals the memory span, but the view has overlaps and gaps. It is incorrectly marked contiguous, so the reduction sums addresses 0–7.