Add wrap_negative_indices to take_along_axis and avoid upcasting the take_along_dim index when wrap_negative_indices=False.
In that case, there is no risk of overflows.
The dtype change trips up Mosaic TPU, which expects 8-bit indices for
8-bit values.
Based on https://github.com/jax-ml/jax/pull/37421 by apaszke.
Co-authored-by: Adam Paszke <apaszke@google.com>
PiperOrigin-RevId: 929986337