{"record":{"id":"7d7eceeecb052fb4","repo":"keras-team/keras","slug":"the-channel-dimension-of-the-inputs-last-axis-sh","errorCode":null,"errorMessage":"The channel dimension of the inputs (last axis) should be defined. Found None. Full input shape received: input_shape={inputs_shape}","messagePattern":"The channel dimension of the inputs \\(last axis\\) should be defined\\. Found None\\. Full input shape received: input_shape=(.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"keras/src/layers/rnn/conv_lstm.py","lineNumber":178,"sourceCode":"        self.dropout_mask_count = 4\n        self.input_spec = InputSpec(ndim=rank + 2)\n        self.state_size = -1  # Custom, defined in methods\n\n    def build(self, inputs_shape, states_shape=None):\n        if self.data_format == \"channels_first\":\n            channel_axis = 1\n            self.spatial_dims = inputs_shape[2:]\n        else:\n            channel_axis = -1\n            self.spatial_dims = inputs_shape[1:-1]\n        if None in self.spatial_dims:\n            raise ValueError(\n                \"ConvLSTM layers only support static \"\n                \"input shapes for the spatial dimension. \"\n                f\"Received invalid input shape: input_shape={inputs_shape}\"\n            )\n        if inputs_shape[channel_axis] is None:\n            raise ValueError(\n                \"The channel dimension of the inputs (last axis) should be \"\n                \"defined. Found None. Full input shape received: \"\n                f\"input_shape={inputs_shape}\"\n            )\n        self.input_spec = InputSpec(\n            ndim=self.rank + 3, shape=(None,) + inputs_shape[1:]\n        )\n\n        input_dim = inputs_shape[channel_axis]\n        self.input_dim = input_dim\n        self.kernel_shape = self.kernel_size + (input_dim, self.filters * 4)\n        recurrent_kernel_shape = self.kernel_size + (\n            self.filters,\n            self.filters * 4,\n        )\n\n        self.kernel = self.add_weight(\n            shape=self.kernel_shape,","sourceCodeStart":160,"sourceCodeEnd":196,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/layers/rnn/conv_lstm.py#L160-L196","documentation":"Raised by ConvLSTM.build when the channel axis of the input (last axis for channels_last, axis 1 for channels_first) is None. Without a known channel count the layer cannot size its kernel, so it rejects the shape at build time.","triggerScenarios":"Thrown at keras/src/layers/rnn/conv_lstm.py:178 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Define the channel dimension in the input shape, e.g. Input(shape=(timesteps, h, w, 3))","Ensure an upstream layer does not produce an undefined channel axis (e.g. operations that collapse the last dim dynamically)"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7a34a03db60bf60042242d6a556fc3be119046a5","analyzedAt":"2026-08-25T21:25:25.994Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}