keras-team/keras · error · ValueError

Invalid value received for argument `noise_shape`. Expected

Error message

Invalid value received for argument `noise_shape`. Expected an iterable of integers (e.g., a tuple or list). Received: noise_shape={noise_shape}

What it means

Error "Invalid value received for argument `noise_shape`. Expected an iterable of integers (e.g., a tuple or list). Received: noise_shape={noise_shape}" thrown in keras-team/keras.

Source

Thrown at keras/src/layers/regularization/dropout.py:73

        self._build_at_init()

    def _validate_noise_shape(self, noise_shape):
        if noise_shape is None:
            return None

        if isinstance(noise_shape, str):
            raise ValueError(
                f"Invalid value received for argument `noise_shape`. "
                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(

View on GitHub (pinned to 7a34a03db6)

When it happens

Trigger: Thrown at keras/src/layers/regularization/dropout.py:73 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/f79598dc39e7386c. Report an issue: GitHub.