user2543622
user2543622

Reputation: 6756

keras understanding parameters for LSTM layer

on the page, why does lstm layer has 131584 parameters? each sentence has 500 words max and word embedding have 128 dimensions.

Upvotes: 0

Views: 320

Answers (1)

ixeption
ixeption

Reputation: 2050

The number of parameters of LSTM, taking input vectors of size m and giving output vectors of size n

is:

4(nm+n^2)

With bias vectors, the number becomes:

4(nm+n^2 + n)

131584 = 4*(128*128 + 128^2 + 128)

More: https://datascience.stackexchange.com/questions/10615/number-of-parameters-in-an-lstm-model

Upvotes: 1

Related Questions