keras-team/keras · error · ValueError

bottom_cropping must be >= 0. Received: bottom_cropping={bot

Error message

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

What it means

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

Source

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

            target_height = height - self.top_cropping - self.bottom_cropping
        target_width = self.target_width
        if target_width is None:
            target_width = width - self.left_cropping - self.right_cropping

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

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

View on GitHub (pinned to 7a34a03db6)

When it happens

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