Skip to content
Advertisement

num_units in GRU and LSTM layers in keras Tensorflow 2 – confuse meaning

I know that this question raised many time, but I could not get a clear answer because there are different answers: In tf.keras.layers.LSTM tf.keras.layers.GRU layers there is a parameter called num_units. I saw a lot of questions over the internet about this parameter. and there is not clear answer for what this parameter mean expect for the obvious meaning which is the shape of the output. some say that its mean that in each layer there num_units of LSTM or GRU units, some say that it is only one unit of LSTM or GRU, but with num_units hidden units (num_units of tanh, and sigmoids for each gate and so on..) inside the LSTM or GRU layer.

Advertisement

Answer

The argument, num_units in an LSTM Layer refers to number of LSTM Units in that Layer, with each LSTM Unit comprising the below Architecture.

enter image description here

Advertisement