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: inputs.shape={inputs.shape}, cropping={self.cropping} What it means
Error "`cropping` parameter of `Cropping1D` layer must be smaller than the input length. Received: inputs.shape={inputs.shape}, cropping={self.cropping}" thrown in keras-team/keras.
Source
Thrown at keras/src/layers/reshaping/cropping1d.py:69
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}"
)
if self.cropping[1] == 0:
return inputs[:, self.cropping[0] :, :]
else:
return inputs[:, self.cropping[0] : -self.cropping[1], :]
def get_config(self):
config = {"cropping": self.cropping}
base_config = super().get_config()
return {**base_config, **config}
View on GitHub (pinned to 7a34a03db6)
When it happens
Trigger: Thrown at keras/src/layers/reshaping/cropping1d.py:69 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/0adfa0e9b51ceb32.
Report an issue: GitHub.