jax icon indicating copy to clipboard operation
jax copied to clipboard

improve IndexError error message from abstracted values

Open mattjj opened this issue 3 years ago • 2 comments

This message could be improved to point to the specific reason (jit, pmap, fori_loop, etc) and user source line which caused the problematic tracing: "IndexError: Array slice indices must have static start/stop/step to be used with NumPy indexing syntax. To index a statically sized array at a dynamic position, try lax.dynamic_slice/dynamic_update_slice (JAX does not support dynamically sized arrays within JIT compiled functions)."

mattjj avatar Jul 08 '21 21:07 mattjj

Hi @mattjj

It looks like the error message has been improved by including f"Found slice({i.start}, {i.stop}, {i.step}) " in the error message by the PR #8124.

Please refer https://stackoverflow.com/questions/76611278/indexerror-array-slice-indices-must-have-static-start-stop-step-to-be-used-with to see the improved error message.

Thank you.

rajasekharporeddy avatar Feb 23 '24 10:02 rajasekharporeddy

Thanks for checking! I think we should still improve this further though...

mattjj avatar Feb 23 '24 19:02 mattjj