How to calculate the number of parameters of an LSTM network?

后端 未结 6 528
情歌与酒
情歌与酒 2020-12-04 20:37

Is there a way to calculate the total number of parameters in a LSTM network.

I have found a example but I\'m unsure of how correct this is or If I have understood i

6条回答
  •  有刺的猬
    2020-12-04 20:57

    No - the number of parameters of a LSTM layer in Keras equals to:

    params = 4 * ((size_of_input + 1) * size_of_output + size_of_output^2)
    

    Additional 1 comes from bias terms. So n is size of input (increased by the bias term) and m is size of output of a LSTM layer.

    So finally :

    4 * (4097 * 256 + 256^2) = 4457472
    

提交回复
热议问题