There isn’t a necessary relation between input and hidden size. But we usually set it to numbers like 32, 64, 128(u can try what number is better).
They must be presented the same in the batch, but they don’t have to be the same. You can, for example, pad inputs with different lengths into a certain max_length.