What do you mean “return h”? IIRC the output of a GRU cell is the hidden state itself (you feed it back to itself as the previous hidden state)
Also, I had some unit tests in place, and could confirm that this code returned close-enough results to PyTorch’s GRUCell implementation