Number of parameters for Keras SimpleRNN

后端 未结 3 402
礼貌的吻别
礼貌的吻别 2020-12-11 05:53

I have a simpleRNN like:

model.add(SimpleRNN(10, input_shape=(3, 1)))
model.add(Dense(1, activation=\"linear\"))
         


        
3条回答
  •  粉色の甜心
    2020-12-11 06:27

    It might be easier to understand visually with a simple network like this:

    The number of weights is 16 (4 * 4) + 12 (3 * 4) = 28 and the number of biases is 4.

    where 4 is the number of units and 3 is the number of input dimensions, so the formula is just like in the first answer: num_units ^ 2 + num_units * input_dim + num_units or simply num_units * (num_units + input_dim + 1), which yields 10 * (10 + 1 + 1) = 120 for the parameters given in the question.

提交回复
热议问题