keras-team/keras · error · ValueError

bottom_padding must be >= 0. Received: bottom_padding={botto

Error message

bottom_padding must be >= 0. Received: bottom_padding={bottom_padding}

What it means

Error "bottom_padding must be >= 0. Received: bottom_padding={bottom_padding}" thrown in keras-team/keras.

Source

Thrown at keras/src/ops/image.py:1683

            target_height = self.top_padding + height + self.bottom_padding
        target_width = self.target_width
        if target_width is None and width is not None:
            target_width = self.left_padding + width + self.right_padding

        if height is not None:
            top_padding = self.top_padding
            bottom_padding = self.bottom_padding
            if top_padding is None:
                top_padding = target_height - height - bottom_padding
            if bottom_padding is None:
                bottom_padding = target_height - height - top_padding
            if top_padding < 0:
                raise ValueError(
                    "top_padding must be >= 0. "
                    f"Received: top_padding={top_padding}"
                )
            if bottom_padding < 0:
                raise ValueError(
                    "bottom_padding must be >= 0. "
                    f"Received: bottom_padding={bottom_padding}"
                )
            if target_height < 0:
                raise ValueError(
                    "target_height must be >= 0. "
                    f"Received: target_height={target_height}"
                )

        if width is not None:
            left_padding = self.left_padding
            right_padding = self.right_padding
            if left_padding is None:
                left_padding = target_width - width - right_padding
            if right_padding is None:
                right_padding = target_width - width - left_padding
            if left_padding < 0:
                raise ValueError(

View on GitHub (pinned to 7a34a03db6)

When it happens

Trigger: Thrown at keras/src/ops/image.py:1683 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/0c3c91193ef09643. Report an issue: GitHub.