# Input layer is incompatible even when dimensions (apparently) match

I am making a sequential neural network for classification, with 3 dense layers, which will be trained on a simple synthetic dataset. The description of dataset is as follows:

• Data and class labels are integers. They are 2000 each.
• There is only a single feature column (populated by np.arange(2000) * 3)
• There is only a single label which indicates last digit of number (populated by np.arange(2000) *3 % 10).

After making the model, I am encountering the following error when calling model.fit():

ValueError: Input 0 of layer sequential is incompatible with the layer: expected axis -1 of input shape to have value 1500 but received input with shape (100, 1)

You set the input shape to (1500, 2) whereas your data only contains a single feature. You should therefore change the shape to (1,) or (None, 1) to match the shape of the input data.
• It works! Thanks for the answer. Can you explain why does (None, 1) also work? Mar 28, 2021 at 17:11
• @hhj8i (1,) and (None,1) are identical in this case Mar 28, 2021 at 17:32
• None can stand for any number, in this case the number of samples in a single batch. Mar 28, 2021 at 17:38
• I was also wondering that the feature and label columns in training data, have 1500 values each. But an array with shape (1, ) can contain a single value only. So will the training be accurate when using input_shape = (1, )? So far, I am getting 9% accuracy on training data. Mar 28, 2021 at 18:39