I had a doubt in the first lab of Course 2.
I wanted to understand why the input is being reshaped to make it 2D?
X_train[0].reshape(1,1).
Thank you.
Hello @suhasbn,
According to the tensorflow documentation, the input has to be at least 2D, and in our case, we need to make the input have the shape of (batch_size, input_dim)
. Since X_train[0]
has one sample (batch_size=1
) and has only one feature (input_dim=1
) for the sample, the shape has to be (1, 1)
.
Cheers!
Raymond