{"record":{"id":"1b111873338a6018","repo":"keras-team/keras","slug":"number-of-groups-self-groups-cannot-be-more-th","errorCode":null,"errorMessage":"Number of groups ({self.groups}) cannot be more than the number of channels ({dim}).","messagePattern":"Number of groups \\((.+?)\\) cannot be more than the number of channels \\((.+?)\\)\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"keras/src/layers/normalization/group_normalization.py","lineNumber":117,"sourceCode":"        self.gamma_regularizer = regularizers.get(gamma_regularizer)\n        self.beta_constraint = constraints.get(beta_constraint)\n        self.gamma_constraint = constraints.get(gamma_constraint)\n\n    def build(self, input_shape):\n        dim = input_shape[self.axis]\n\n        if dim is None:\n            raise ValueError(\n                f\"Axis {self.axis} of input tensor should have a defined \"\n                \"dimension but the layer received an input with shape \"\n                f\"{input_shape}.\"\n            )\n\n        if self.groups == -1:\n            self.groups = dim\n\n        if dim < self.groups:\n            raise ValueError(\n                f\"Number of groups ({self.groups}) cannot be more than the \"\n                f\"number of channels ({dim}).\"\n            )\n\n        if dim % self.groups != 0:\n            raise ValueError(\n                f\"Number of groups ({self.groups}) must be a multiple \"\n                f\"of the number of channels ({dim}).\"\n            )\n\n        self.input_spec = InputSpec(\n            ndim=len(input_shape), axes={self.axis: dim}\n        )\n\n        if self.scale:\n            self.gamma = self.add_weight(\n                shape=(dim,),\n                name=\"gamma\",","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/layers/normalization/group_normalization.py#L99-L135","documentation":"Error \"Number of groups ({self.groups}) cannot be more than the number of channels ({dim}).\" thrown in keras-team/keras.","triggerScenarios":"Thrown at keras/src/layers/normalization/group_normalization.py:117 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"}