You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We use the type-annotation Scalar = int | float | jax.Array frequently in the code-base. The jax.Array is included because certain functions receive floats and return zero-dimensional jax.Array's.
This is not ideal, since
We would like the type-checker to be able to tell the difference between scalars and arrays with at least one dimension, and
It can be confusing for people reading the code.
Second issue is that Array types do not include dtype information, this would be helpful in many cases (e.g., for grids, distinguishing between indices and values). See here.
ToDo's:
Create list of code-blocks that actually require Scalar to contain jax.Array
Problem
We use the type-annotation
Scalar = int | float | jax.Array
frequently in the code-base. Thejax.Array
is included because certain functions receivefloats
and return zero-dimensionaljax.Array
's.This is not ideal, since
Second issue is that
Array
types do not include dtype information, this would be helpful in many cases (e.g., for grids, distinguishing between indices and values). See here.ToDo's:
Scalar
to containjax.Array
Solution ideas
jaxtyping
Could then do:
preventing use of
Scalar
when we really need a 1+ dimensional array?jaxtyping would also allow annotating Arrays with dtype info.
The text was updated successfully, but these errors were encountered: