sn.anurag
sn.anurag

Reputation: 621

In Keras, when should I use input_shape instead of input_dim?

I have found the use of input_shape instead of input_dim in Keras, especially in LSTM problems? My concern is that input_shape limits the number of rows in the input. It doesn't leave the scope to give complete Dataframe as input. When should we use input_shape instead of input_dim?

Here are the examples https://machinelearningmastery.com/timedistributed-layer-for-long-short-term-memory-networks-in-python/

Upvotes: 3

Views: 3136

Answers (1)

nuric
nuric

Reputation: 11225

To build on the comment and address the point of confusion. You can specify an unknown dimension using None to give varying values at runtime. For example, input_shape=(None, 10) means varying number of rows each with 10 entries. input_dim is just a short cut for specifying the final dimension and is there for convenience.

Upvotes: 4

Related Questions