Skip to content

Commit 6f7a1d5

Browse files
committed
Add comment clarifying the intent of the Array/ArrayLike annotations
1 parent 14e6d68 commit 6f7a1d5

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

jax/_src/typing.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,16 @@ class HasDtypeAttribute(Protocol):
4545
DimSize = Union[int, Any] # extensible
4646
Shape = Sequence[DimSize]
4747

48-
# Array is a type annotation for JAX arrays and tracers.
48+
# Array is a type annotation for standard JAX arrays and tracers produced by
49+
# core functions in jax.lax and jax.numpy; it is not meant to include
50+
# future non-standard array types like KeyArray and BInt.
4951
# For now we set it to Any; in the future this will be more restrictive
5052
# (see https://github.com/google/jax/pull/11859)
5153
# TODO(jakevdp): make this conform to the JEP 12049 plan.
5254
Array = Any
5355

54-
# ArrayLike is a Union of all objects that can be implicitly converted to a JAX array.
56+
# ArrayLike is a Union of all objects that can be implicitly converted to a standard
57+
# JAX array (i.e. not including future non-standard array types like KeyArray and BInt).
5558
ArrayLike = Union[
5659
Array, # JAX array type
5760
np.ndarray, # NumPy array type

0 commit comments

Comments
 (0)