Specifying input dimensions on C2_W1_Lab01

I see that we add an argument , specifying the input dimensions when creating this neuron, but later in the course , this specification is ommited. I suppose the neuron understands what the input dimension is automatically.

My question is , what happens if we specify an input dimension smaller or less that the output from the previous neuron? Or in other words, what purpose does the input_dim argument serve if there can only be one correct answer dimensions number?

The input_dim is used usually for the first layer of the network when feature’s data are fed into the model. Afterwords in the coming layers, the previous input layer is fed into the new layer so no need for input_dim. If there is a shape mismatch an error will be thrown.

1 Like

I have opened the second Lab file, and specified the input_dim for the first layer.
I have set it to 1 and 3 as well, although our Xt training set, has only two features.
The model training begun normally without errors in both occasions.
I dont understand why this argument exists and why It did not return an error, especially when I set the input dimensions to 3 , which is more than our features.

Another detail is that in this example, there is a line of code just above, specifying the same thing (I think so).
image

The first layer is the Input layer not the dense which come after it.