move rnn cell size check to cpp (#51964)
Summary:
Fixes https://github.com/pytorch/pytorch/issues/32193.
Possible further improvements:
- do the same for quantized cells
- reuse newly written functions in https://github.com/pytorch/pytorch/blob/56034636b9f37b54dacfab8794e93ba6b10bdfc7/torch/csrc/api/src/nn/modules/rnn.cpp#L699-L715
Pull Request resolved: https://github.com/pytorch/pytorch/pull/51964
Reviewed By: albanD
Differential Revision: D26757050
Pulled By: ngimel
fbshipit-source-id: 9c917d9124de2b914ad9915c79af675ae561295a