Skip to content
tmpl

scatter_on_index_corner

::mlx::core::array scatter_on_index_corner()

An axis scatter over the corner of base that idx covers.

The index may be shorter than base on every axis but dim and shorter than src on every axis — the reference's rule, and the CPU's. MLX's axis scatters want all three to agree off dim and raised "[broadcast_shapes] Shapes (4) and (2) cannot be broadcast" for a valid call. So src is cut to the index's extent, the scatter runs on the matching corner of base, and the corner is written back.