{"record":{"id":"24f11c4d5dea2ac2","repo":"keras-team/keras","slug":"values-in-cropping-argument-should-be-smaller-th","errorCode":null,"errorMessage":"Values in `cropping` argument should be smaller than the corresponding spatial dimension of the input. Received: input_shape={input_shape}, cropping={self.cropping}","messagePattern":"Values in `cropping` argument should be smaller than the corresponding spatial dimension of the input\\. Received: input_shape=(.+?), cropping=(.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"keras/src/layers/reshaping/cropping2d.py","lineNumber":98,"sourceCode":"            raise ValueError(\n                \"`cropping` should be either an int, a tuple of 2 ints \"\n                \"(symmetric_height_crop, symmetric_width_crop), \"\n                \"or a tuple of 2 tuples of 2 ints \"\n                \"((top_crop, bottom_crop), (left_crop, right_crop)). \"\n                f\"Received: cropping={cropping}.\"\n            )\n        self.input_spec = InputSpec(ndim=4)\n\n    def compute_output_shape(self, input_shape):\n        if self.data_format == \"channels_first\":\n            if (\n                input_shape[2] is not None\n                and sum(self.cropping[0]) >= input_shape[2]\n            ) or (\n                input_shape[3] is not None\n                and sum(self.cropping[1]) >= input_shape[3]\n            ):\n                raise ValueError(\n                    \"Values in `cropping` argument should be smaller than the \"\n                    \"corresponding spatial dimension of the input. Received: \"\n                    f\"input_shape={input_shape}, cropping={self.cropping}\"\n                )\n            return (\n                input_shape[0],\n                input_shape[1],\n                (\n                    input_shape[2] - self.cropping[0][0] - self.cropping[0][1]\n                    if input_shape[2] is not None\n                    else None\n                ),\n                (\n                    input_shape[3] - self.cropping[1][0] - self.cropping[1][1]\n                    if input_shape[3] is not None\n                    else None\n                ),\n            )","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/layers/reshaping/cropping2d.py#L80-L116","documentation":"Error \"Values in `cropping` argument should be smaller than the corresponding spatial dimension of the input. Received: input_shape={input_shape}, cropping={self.cropping}\" thrown in keras-team/keras.","triggerScenarios":"Thrown at keras/src/layers/reshaping/cropping2d.py:98 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7a34a03db60bf60042242d6a556fc3be119046a5","analyzedAt":"2026-08-25T21:25:25.994Z","schemaVersion":2},"datasetVersion":"2026-08-26T02:17:13.382Z"}