{"record":{"id":"b5e6b84f298ed8a9","repo":"keras-team/keras","slug":"cropping-should-be-either-an-int-a-tuple-of-2-i","errorCode":null,"errorMessage":"`cropping` should be either an int, a tuple of 2 ints (symmetric_height_crop, symmetric_width_crop), or a tuple of 2 tuples of 2 ints ((top_crop, bottom_crop), (left_crop, right_crop)). Received: cropping={cropping}.","messagePattern":"`cropping` should be either an int, a tuple of 2 ints \\(symmetric_height_crop, symmetric_width_crop\\), or a tuple of 2 tuples of 2 ints \\(\\(top_crop, bottom_crop\\), \\(left_crop, right_crop\\)\\)\\. Received: cropping=(.+?)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"keras/src/layers/reshaping/cropping2d.py","lineNumber":80,"sourceCode":"                    \"`cropping` cannot be negative. \"\n                    f\"Received: cropping={cropping}.\"\n                )\n            self.cropping = ((cropping, cropping), (cropping, cropping))\n        elif hasattr(cropping, \"__len__\"):\n            if len(cropping) != 2:\n                raise ValueError(\n                    \"`cropping` should have two elements. \"\n                    f\"Received: cropping={cropping}.\"\n                )\n            height_cropping = argument_validation.standardize_tuple(\n                cropping[0], 2, \"1st entry of cropping\", allow_zero=True\n            )\n            width_cropping = argument_validation.standardize_tuple(\n                cropping[1], 2, \"2nd entry of cropping\", allow_zero=True\n            )\n            self.cropping = (height_cropping, width_cropping)\n        else:\n            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(","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/layers/reshaping/cropping2d.py#L62-L98","documentation":"Error \"`cropping` should be either an int, a tuple of 2 ints (symmetric_height_crop, symmetric_width_crop), or a tuple of 2 tuples of 2 ints ((top_crop, bottom_crop), (left_crop, right_crop)). Received: cropping={cropping}.\" thrown in keras-team/keras.","triggerScenarios":"Thrown at keras/src/layers/reshaping/cropping2d.py:80 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"}