keras-team/keras · error · ValueError
top_cropping must be >= 0. Received: top_cropping={top_cropp
Error message
top_cropping must be >= 0. Received: top_cropping={top_cropping} What it means
Error "top_cropping must be >= 0. Received: top_cropping={top_cropping}" thrown in keras-team/keras.
Source
Thrown at keras/src/ops/image.py:1957
f"target_width={self.target_width}"
)
target_height = self.target_height
if target_height is None:
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:View on GitHub (pinned to 7a34a03db6)
When it happens
Trigger: Thrown at keras/src/ops/image.py:1957 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/3fece31454520bea.
Report an issue: GitHub.