Repository: pytorch
Issue: nn.Conv(n)d constructor doesn't check for the number of kernel dimensions
Labels: module: nn,module: convolution,triaged

## 🐛 Bug

Convolution module constructors do not check for input argument kernel_size length, neither does forward method check for number of kernel dimensions, which makes it possible to use Conv1d as Conv2d vice versa and so on, which in turn may lead to confusion in new users.
 
## To Reproduce

```python
import torch
a = torch.nn.Conv1d(24, 42, (3, 3))
b = torch.nn.Conv2d(24, 42, (3, 3))
a.weight.shape == b.weight.shape
Out[5]: True
a.bias.shape == b.bias.shape
Out[6]: True
a.weight = b.weight
a.bias = b.bias
t = torch.randn(1, 24, 12, 12)
(a(t) == b(t)).all()
Out[10]: tensor(True)

```

## Expected behavior

An exception should be raised if kernel, padding, or stride number of dimensions doesn't match number of convolution dimensions.

## Environment

PyTorch version: 1.2.0                                                                                                                                     
Is debug build: No                                                       
CUDA used to build PyTorch: 10.0.130                                     
                                                                                                                                                                    
OS: Ubuntu 19.04                                                                                                                                                    
GCC version: (Ubuntu 6.5.0-2ubuntu1) 6.5.0 20181026                          
CMake version: version 3.13.4                                                                                                                                      
                                                                                                            
Python version: 3.7                                                   
Is CUDA available: Yes                                                   
CUDA runtime version: 10.1.243                                                            
GPU models and configuration:                             
GPU 0: GeForce GTX 1080 Ti                                                                    
GPU 1: GeForce GTX 1080 Ti                                                        
GPU 2: GeForce GTX 1080 Ti                                                                                                                                         
                                                                                                                                                                    
Nvidia driver version: 418.87.00                                                                                                                                   
cuDNN version: 7.6.3          

Versions of relevant libraries:
[pip3] numpy==1.17.2
[pip3] torch==1.2.0
[pip3] torchvision==0.4.0
[conda] _pytorch_select           0.2                       gpu_0
[conda] blas                      1.0                         mkl
[conda] mkl                       2019.4                      243
[conda] mkl-service               2.3.0            py37he904b0f_0
[conda] mkl_fft                   1.0.14           py37ha843d7b_0
[conda] mkl_random                1.1.0            py37hd6b4f25_0
[conda] pytorch                   1.3.0           py3.7_cuda10.1.243_cudnn7.6.3_0    pytorch-nightly
[conda] pytorch-lamb              1.0.0                    pypi_0    pypi
[conda] torch-cluster             1.4.5                    pypi_0    pypi
[conda] torch-dct                 0.1.5                    pypi_0    pypi
[conda] torch-geometric           1.3.2                    pypi_0    pypi
[conda] torch-scatter             1.3.2                    pypi_0    pypi
[conda] torch-sparse              0.4.3                    pypi_0    pypi
[conda] torch-spline-conv         1.1.1                    pypi_0    pypi
[conda] torchdiffeq               0.0.1                    pypi_0    pypi
[conda] torchfile                 0.1.0                    pypi_0    pypi
[conda] torchvision               0.4.1                py37_cu101    pytorch-nightly