keras-team/keras · error · ValueError
Invalid value received for argument `noise_shape`. Expected
Error message
Invalid value received for argument `noise_shape`. Expected all elements to be integers or None. Received element at index {i}: {dim} (type: {type(dim).__name__}) What it means
Error "Invalid value received for argument `noise_shape`. Expected all elements to be integers or None. Received element at index {i}: {dim} (type: {type(dim).__name__})" thrown in keras-team/keras.
Source
Thrown at keras/src/layers/regularization/dropout.py:83
f"Expected a tuple or list of integers. "
f"Received: noise_shape={noise_shape}"
)
if not isinstance(noise_shape, tuple):
try:
noise_shape = tuple(noise_shape)
except TypeError:
raise ValueError(
f"Invalid value received for argument `noise_shape`. "
f"Expected an iterable of integers "
f"(e.g., a tuple or list). "
f"Received: noise_shape={noise_shape}"
)
for i, dim in enumerate(noise_shape):
if dim is not None:
if not isinstance(dim, int):
raise ValueError(
f"Invalid value received for argument `noise_shape`. "
f"Expected all elements to be integers or None. "
f"Received element at index {i}: {dim} "
f"(type: {type(dim).__name__})"
)
if dim <= 0:
raise ValueError(
f"Invalid value received for argument `noise_shape`. "
f"Expected all dimensions to be positive integers "
f"or None. "
f"Received negative or zero value at index {i}: {dim}"
)
return noise_shape
def call(self, inputs, training=False):
if training and self.rate > 0:View on GitHub (pinned to 7a34a03db6)
When it happens
Trigger: Thrown at keras/src/layers/regularization/dropout.py:83 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/f2c46a5ec8877000.
Report an issue: GitHub.