update argument checks from padding layers (#102253)
replacement of https://github.com/pytorch/pytorch/pull/99608, breaking the old pr into smaller ones.
this one handles the common error message from both CPU and CUDA device, to simplify the code.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/102253
Approved by: https://github.com/cpuhrsch, https://github.com/albanD