keras-team/keras · error · ValueError
`cropping` parameter of `Cropping1D` layer must be smaller t
Error message
`cropping` parameter of `Cropping1D` layer must be smaller than the input length. Received: input_shape={input_shape}, cropping={self.cropping} What it means
Error "`cropping` parameter of `Cropping1D` layer must be smaller than the input length. Received: input_shape={input_shape}, cropping={self.cropping}" thrown in keras-team/keras.
Source
Thrown at keras/src/layers/reshaping/cropping1d.py:55
Input shape:
3D tensor with shape `(batch_size, axis_to_crop, features)`
Output shape:
3D tensor with shape `(batch_size, cropped_axis, features)`
"""
def __init__(self, cropping=(1, 1), **kwargs):
super().__init__(**kwargs)
self.cropping = argument_validation.standardize_tuple(
cropping, 2, "cropping", allow_zero=True
)
self.input_spec = InputSpec(ndim=3)
def compute_output_shape(self, input_shape):
if input_shape[1] is not None:
length = input_shape[1] - self.cropping[0] - self.cropping[1]
if length <= 0:
raise ValueError(
"`cropping` parameter of `Cropping1D` layer must be "
"smaller than the input length. Received: input_shape="
f"{input_shape}, cropping={self.cropping}"
)
else:
length = None
return (input_shape[0], length, input_shape[2])
def call(self, inputs):
if (
inputs.shape[1] is not None
and sum(self.cropping) >= inputs.shape[1]
):
raise ValueError(
"`cropping` parameter of `Cropping1D` layer must be "
"smaller than the input length. Received: inputs.shape="
f"{inputs.shape}, cropping={self.cropping}"
)View on GitHub (pinned to 7a34a03db6)
When it happens
Trigger: Thrown at keras/src/layers/reshaping/cropping1d.py:55 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/964a21b5c7b6d5ea.
Report an issue: GitHub.