As described in the docs nn.GRU yields two outputs: output and h_n.
You are unwrapping the second return value into h_n and h_c, which works fine if a single layer is used, since the shape of h_n is defined as [directions * num_layers, batch_size, H_out] (directions=2 since you are using bidirectional=True).
However, if you are using num_layers=2 then the first dimension will have a size of 4 instead of 2 so unwrapping this tensor to h_n and h_c won’t work and you might want to assign it to h_n only and split it afterwards if needed.