Returning the same variable twice?

In the lab for the vanilla RNN and GRU, the same variable (hidden state) is returned twice. May I understand why? I tried to remove one of them but then the returned result is the 1st element only.

def forward_V_RNN(inputs, weights):

# weights.
wh, _, _, bh, _, _ = weights

# new hidden state
h_t =, np.concatenate([h_t, x])) + bh
h_t = sigmoid(h_t)

return h_t, h_t

There is nothing wrong with this, the hidden state is the logit too (which you can feed into a sigmoid function and get your result), if you’ve got a different architecture which has a different logit than the hidden state, you can use different values.