Rnn base hidden size type check (#105659)
Fixes #105631
Added a type and value check on `hidden_size` to align behaviour between GPU and CPU modes and alert users when the wrong type is supplied.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/105659
Approved by: https://github.com/albanD, https://github.com/mikaylagawarecki