ponir
ponir

Reputation: 477

Why does tensorlow LSTM takes only the hidden size as input?

In the tensorflow LSTM cell we only initialize it by number of units (num_units) which is the hidden size of the cell. However, the cell should also take an input x. And since the underlying operation is a matrix multiplication operation the size of x should also play a role in setting up the LSTM weight. So, shouldn't the cell take the size of the input x also as an initialization parameter?

Upvotes: 1

Views: 280

Answers (1)

Dmytro Danevskyi
Dmytro Danevskyi

Reputation: 3159

LSTM cell (or other types of RNN cells) is just an object you pass to the function such as tf.nn.rnn. tf.nn.rnn takes cell and data for input. Cell is called inside of rnn function with the data you've passed to tf.nn.rnn.

Upvotes: 2

Related Questions