Repository: pytorch
Issue: Confusing error messages from `torch.nn.LazyLinear` in different versions.
Labels: module: error checking,triaged,module: lazy

### 🐛 Describe the bug


This issue should be related to [#77415](https://github.com/pytorch/pytorch/issues/77415).

In different versions of PyTorch, `LazyLinear` has different error messages for the inconsistency between the model dtype and the input dtype.
In addition, no matter which version it is, these raised error messages are not clear, which makes people feel a little confused.
The following reproducible code can provide an example.


### To Reproduce
```python
import torch
from torch import nn

def test():
    tmp_result= torch.nn.LazyLinear(out_features=5)
    # tmp_result= torch.nn.LSTMCell(5,5)
    return tmp_result
net = test()

t = torch.ones(5, dtype=torch.double)
net(t)

```

### Error Results

For PyTorch 1.12.0, the above code will raise:
```
RuntimeError: expected scalar type Float but found Double
```

For PyTorch 1.11.0/1.13.0, the above code will raise:

```
RuntimeError: expected scalar type Double but found Float
```

It is shown that for the same problem, different versions return different error messages, and the expected scalar type and the found type are completely opposite in different versions.
To make matters worse, the information provided by such an error report is also very limited, which may give people the illusion that I am not passing the variable of the type I want to the network.

### Expected behavior

I think the error message was given by `torch.nn.LSTMCell` in 1.13.0 and later versions are more intuitive (its error message in 1.12.0 is the same as that of `LazyLinear` in that version).
In RuntimeError, it could directly tell the users that the dtype of the model and the input must be the same.
```
Traceback (most recent call last):
  File "test.py", line 11, in <module>
    net(t)
  File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
    return forward_call(*input, **kwargs)
  File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/rnn.py", line 1194, in forward
    ret = _VF.lstm_cell(
RuntimeError: mat1 and mat2 must have the same dtype
```

### Versions



<details>
  <summary>pytorch 1.11.0</summary>
  <pre><code>
  [pip3] numpy==1.21.6
  [pip3] pytorch-lightning==1.6.3
  [pip3] torch==1.11.0
  [pip3] torch-tb-profiler==0.4.0
  [pip3] torchaudio==0.11.0
  [pip3] torchmetrics==0.9.0
  [pip3] torchvision==0.12.0
  [conda] blas                      1.0                         mkl  
  [conda] cudatoolkit               11.3.1               h2bc3f7f_2  
  [conda] ffmpeg                    4.3                  hf484d3e_0    pytorch
  [conda] mkl                       2021.4.0           h06a4308_640  
  [conda] mkl-service               2.4.0            py38h7f8727e_0  
  [conda] mkl_fft                   1.3.1            py38hd3c417c_0  
  [conda] mkl_random                1.2.2            py38h51133e4_0  
  [conda] numpy                     1.19.5                   pypi_0    pypi
  [conda] numpy-base                1.21.5           py38hf524024_1  
  [conda] pytorch                   1.11.0          py3.8_cuda11.3_cudnn8.2.0_0    pytorch
  [conda] pytorch-lightning         1.6.3                    pypi_0    pypi
  [conda] pytorch-mutex             1.0                        cuda    pytorch
  [conda] torch                     1.10.0                   pypi_0    pypi
  [conda] torch-tb-profiler         0.4.0                    pypi_0    pypi
  [conda] torchaudio                0.11.0               py38_cu113    pytorch
  [conda] torchmetrics              0.9.0                    pypi_0    pypi
  [conda] torchvision               0.12.0               py38_cu113    pytorch</code></pre>
</details>

<details>
  <summary>pytorch 1.12.0</summary>
  <pre><code>
  [pip3] numpy==1.21.5
  [pip3] torch==1.12.0
  [pip3] torchelastic==0.2.0
  [pip3] torchtext==0.13.0
  [pip3] torchvision==0.13.0
  [conda] blas                      1.0                         mkl  
  [conda] cudatoolkit               11.3.1               ha36c431_9    nvidia
  [conda] ffmpeg                    4.3                  hf484d3e_0    pytorch
  [conda] mkl                       2021.4.0           h06a4308_640  
  [conda] mkl-service               2.4.0            py37h7f8727e_0  
  [conda] mkl_fft                   1.3.1            py37hd3c417c_0  
  [conda] mkl_random                1.2.2            py37h51133e4_0  
  [conda] numpy                     1.21.5           py37he7a7128_2  
  [conda] numpy-base                1.21.5           py37hf524024_2  
  [conda] pytorch                   1.12.0          py3.7_cuda11.3_cudnn8.3.2_0    pytorch
  [conda] pytorch-mutex             1.0                        cuda    pytorch
  [conda] torchelastic              0.2.0                    pypi_0    pypi
  [conda] torchtext                 0.13.0                     py37    pytorch
  [conda] torchvision               0.13.0               py37_cu113    pytorch</code></pre>
</details>

<details>
  <summary>pytorch 1.13.0</summary>
  <pre><code>
  [pip3] numpy==1.22.3
  [pip3] torch==1.13.0
  [pip3] torchtext==0.14.0
  [pip3] torchvision==0.14.0
  [conda] blas                      1.0                         mkl  
  [conda] ffmpeg                    4.3                  hf484d3e_0    pytorch
  [conda] mkl                       2021.4.0           h06a4308_640  
  [conda] mkl-service               2.4.0            py39h7f8727e_0  
  [conda] mkl_fft                   1.3.1            py39hd3c417c_0  
  [conda] mkl_random                1.2.2            py39h51133e4_0  
  [conda] numpy                     1.22.3           py39he7a7128_0  
  [conda] numpy-base                1.22.3           py39hf524024_0  
  [conda] pytorch                   1.13.0          py3.9_cuda11.6_cudnn8.3.2_0    pytorch
  [conda] pytorch-cuda              11.6                 h867d48c_0    pytorch
  [conda] pytorch-mutex             1.0                        cuda    pytorch
  [conda] torchtext                 0.14.0                     py39    pytorch
  [conda] torchvision               0.14.0               py39_cu116    pytorch</code></pre>
</details>