Repository: pytorch
Issue: [c++] torch::conv2d() expected output_padding to be a single integer value or a list of 3 values 
Labels: module: docs,module: cpp,module: nn,low priority,module: convolution,triaged

## 🐛 Bug

<!-- A clear and concise description of what the bug is. -->

## To Reproduce

Steps to reproduce the behavior:


1. When I use c++ to deploy my model ,I need to rite a NMS function ,I found torch::conv2d() needs a param I can't provide
  
2.my source code is 
```
torch::Tensor soft_nms_3d(torch::Tensor scale_logits, int ksize, float com_strength) {
    int num_scales = scale_logits.sizes()[3];
    torch::Tensor max_each_scale = torch::max_pool2d(scale_logits.permute({0, 3, 1, 2}), {ksize, ksize}, {1},
                                                     {int(ksize / 2)}).permute({0, 2, 3, 1});
    std::tuple<torch::Tensor, torch::Tensor> torch_max_tmp = torch::max(max_each_scale, -1, true);
    torch::Tensor max_all_scale;
    torch::Tensor max_all_scale_idx;
    std::tie(max_all_scale, max_all_scale_idx) = torch_max_tmp;
    torch::Tensor exp_maps = torch::exp(com_strength * (scale_logits - max_all_scale));

    torch::Tensor input = exp_maps.permute({0, 3, 1, 2});
    torch::Tensor weight = torch::full({1, num_scales, ksize, ksize, 1}, 1);
    torch::Tensor bias=torch::ones({0});
    torch::Tensor sum_exp = torch::conv2d(input,weight,bias,{1},{int(ksize/2)},0,1);

    torch::Tensor probs = exp_maps / (sum_exp + 1e-8);
    return probs;
}
```
3. And thrown error is:
```
terminate called after throwing an instance of 'c10::Error'
  what():  expected output_padding to be a single integer value or a list of 3 values to match the convolution dimensions, but got output_padding=[0, 0] (convolution_expand_param_if_needed at /home/wang/software/pytorch/aten/src/ATen/native/Convolution.cpp:286)
frame #0: c10::Error::Error(c10::SourceLocation, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) + 0x6a (0x7fc42195a43a in /home/wang/software/pytorch/torch/lib/tmp_install/lib/libc10.so)
frame #1: <unknown function> + 0x52aa4a (0x7fc433c2da4a in /home/wang/software/pytorch/torch/lib/tmp_install/lib/libcaffe2.so)
frame #2: at::native::_convolution(at::Tensor const&, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, bool, c10::ArrayRef<long>, long, bool, bool, bool) + 0x3c6 (0x7fc433c33c56 in /home/wang/software/pytorch/torch/lib/tmp_install/lib/libcaffe2.so)
frame #3: at::TypeDefault::_convolution(at::Tensor const&, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, bool, c10::ArrayRef<long>, long, bool, bool, bool) const + 0xfd (0x7fc433fcb95d in /home/wang/software/pytorch/torch/lib/tmp_install/lib/libcaffe2.so)
frame #4: torch::autograd::VariableType::_convolution(at::Tensor const&, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, bool, c10::ArrayRef<long>, long, bool, bool, bool) const + 0x2a7 (0x7fc43b2aece7 in /home/wang/software/pytorch/torch/lib/tmp_install/lib/libtorch.so.1)
frame #5: at::native::convolution(at::Tensor const&, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, bool, c10::ArrayRef<long>, long) + 0xe0 (0x7fc433c2c660 in /home/wang/software/pytorch/torch/lib/tmp_install/lib/libcaffe2.so)
frame #6: at::TypeDefault::convolution(at::Tensor const&, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, bool, c10::ArrayRef<long>, long) const + 0xc6 (0x7fc433fcb7d6 in /home/wang/software/pytorch/torch/lib/tmp_install/lib/libcaffe2.so)
frame #7: torch::autograd::VariableType::convolution(at::Tensor const&, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, bool, c10::ArrayRef<long>, long) const + 0x83 (0x7fc43b2b3ca3 in /home/wang/software/pytorch/torch/lib/tmp_install/lib/libtorch.so.1)
frame #8: at::native::conv2d(at::Tensor const&, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, long) + 0xaf (0x7fc433c2bfbf in /home/wang/software/pytorch/torch/lib/tmp_install/lib/libcaffe2.so)
frame #9: at::TypeDefault::conv2d(at::Tensor const&, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, long) const + 0xbc (0x7fc433fcbeec in /home/wang/software/pytorch/torch/lib/tmp_install/lib/libcaffe2.so)
frame #10: torch::autograd::VariableType::conv2d(at::Tensor const&, at::Tensor const&, at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::ArrayRef<long>, long) const + 0x75 (0x7fc43b374e75 in /home/wang/software/pytorch/torch/lib/tmp_install/lib/libtorch.so.1)
frame #11: soft_nms_3d(at::Tensor, int, float) + 0x54f (0x407a1f in ./rfnet)
frame #12: main + 0x77c (0x4069cc in ./rfnet)
frame #13: __libc_start_main + 0xf0 (0x7fc421004830 in /lib/x86_64-linux-gnu/libc.so.6)
frame #14: _start + 0x29 (0x407069 in ./rfnet)
```

<!-- If you have a code sample, error messages, stack traces, please provide it here as well -->

## Expected behavior

I need a c++ interface of conv2d function which can fill weights and bias to do convolution ,this job also can be done through other functions, but I think this function may exists errors.
<!-- A clear and concise description of what you expected to happen. -->

## Environment
Collecting environment information...
PyTorch version: 1.1.0
Is debug build: No
CUDA used to build PyTorch: 9.0.176

OS: Ubuntu 16.04.6 LTS
GCC version: (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609
CMake version: version 3.5.1

Python version: 3.6
Is CUDA available: Yes
CUDA runtime version: 7.5.17
GPU models and configuration: GPU 0: GeForce GTX 1060
Nvidia driver version: 390.87
cuDNN version: Could not collect

Versions of relevant libraries:
[pip] numpy==1.16.4
[pip] torch==1.1.0
[pip] torchvision==0.3.0
[conda] blas                      1.0                         mkl  
[conda] mkl                       2019.4                      243  
[conda] mkl_fft                   1.0.12           py36ha843d7b_0  
[conda] mkl_random                1.0.2            py36hd81dba3_0  
[conda] pytorch                   1.1.0           py3.6_cuda9.0.176_cudnn7.5.1_0    pytorch
[conda] torchvision               0.3.0           py36_cu9.0.176_1    pytorch