{"record":{"id":"470b73eef408242a","repo":"keras-team/keras","slug":"axis-self-axis-of-input-tensor-should-have-a-def","errorCode":null,"errorMessage":"Axis {self.axis} of input tensor should have a defined dimension but the layer received an input with shape {input_shape}.","messagePattern":"Axis (.+?) of input tensor should have a defined dimension but the layer received an input with shape (.+?)\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"keras/src/layers/normalization/group_normalization.py","lineNumber":107,"sourceCode":"        self.supports_masking = True\n        self.autocast = False\n        self.groups = groups\n        self.axis = axis\n        self.epsilon = epsilon\n        self.center = center\n        self.scale = scale\n        self.beta_initializer = initializers.get(beta_initializer)\n        self.gamma_initializer = initializers.get(gamma_initializer)\n        self.beta_regularizer = regularizers.get(beta_regularizer)\n        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}).\"","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/layers/normalization/group_normalization.py#L89-L125","documentation":"Error \"Axis {self.axis} of input tensor should have a defined dimension but the layer received an input with shape {input_shape}.\" thrown in keras-team/keras.","triggerScenarios":"Thrown at keras/src/layers/normalization/group_normalization.py:107 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"}