Keras get_weight interpretation for RNNs

Viewed 1045

When I am running this code with Keras:

networkDrive = Input(batch_shape=(1,length,1))
network = SimpleRNN(3, activation='tanh', stateful=False, return_sequences=True)(networkDrive)

generatorNetwork = Model(networkDrive, network)

predictions = generatorNetwork.predict(noInput, batch_size=length)


print(np.array(generatorNetwork.layers[1].get_weights()))

I am getting this output

[array([[ 0.91814435,  0.2490257 ,  1.09242284]], dtype=float32)
 array([[-0.42028981,  0.68996912, -0.58932084],
       [-0.88647962, -0.17359462,  0.42897415],
       [ 0.19367599,  0.70271438,  0.68460363]], dtype=float32)
 array([ 0.,  0.,  0.], dtype=float32)]

I suppose, that the (3,3) Matrix is the weight matrix, connecting the RNN Units with each other, and one of the two arrays probably is the bias But what is the third?

1 Answers
Related