The description of weight_ih is


weight_ih – the learnable input-hidden weights, of shape (input_size x hidden_size)


But in the source_code, the shape is reversiable
self.weight_ih = Parameter(torch.Tensor(hidden_size, input_size))