keras-team/keras · error · ValueError
Received `None` value for `axis`
Error message
Received `None` value for `axis`
What it means
Error "Received `None` value for `axis`" thrown in keras-team/keras.
Source
Thrown at keras/src/backend/jax/sparse.py:29
Args:
axis: single int or a tuple of ints for the axis argument. The list of
dimensions to reduce or insert.
input_shape: the shape of the input as a tuple ints.
insert_dims: `False` turns dimensions in `axis` to 1s (use case:
reduction along `axis` with `keep_dims=True`). `True`, inserts 1s
according to `axis` (use case: `expand_dims`).
Returns:
A tuple of three lists
- The canonical value for `axis`: always a list, negative values have
been resolved and values are sorted in ascending order.
- The output shape: `input_shape` with 1s at the indices in `axis`, for
use as the `shape` argument of `broadcast_in_dim`.
- The broadcast dimensions: list of dimensions not in `axis`, for use as
the `broadcast_dimensions` argument of `broadcast_in_dim`.
"""
if axis is None:
raise ValueError("Received `None` value for `axis`")
if isinstance(axis, int):
axis = (axis,)
# Check uniqueness.
if len(set(axis)) != len(axis):
raise ValueError(f"Repeated axis in `axis`: {axis}")
result_dims = len(input_shape)
if insert_dims:
result_dims += len(axis)
# Resolve negative values.
canonical_axis = []
for a in axis:
if not -result_dims <= a < result_dims:
raise ValueError(
f"In `axis`, axis {a} is out of bounds for array "
f"of dimension {result_dims}"
)
if a < 0:View on GitHub (pinned to 7a34a03db6)
When it happens
Trigger: Thrown at keras/src/backend/jax/sparse.py:29 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of keras-team/keras@7a34a03db6 (2026-08-25).
Data as JSON: /api/errors/584b4546417205b8.
Report an issue: GitHub.