RuntimeError: "reflection_pad2d" not implemented for 'Byte'
padding = (2, 2, 2, 2)
img = torch.nn.functional.pad(img, padding, mode='reflect')
out = torch.nn.functional.conv2d(img, kernel, groups=img.shape[1])

Here is the complete Error:
  File &quot;/home/amir/PycharmProjects/LPTN/loadPretrainedModel.py&quot;, line 57, in conv_gauss
    img = torch.nn.functional.pad(img, padding, mode='reflect')
  File &quot;/usr/local/lib/python3.8/dist-packages/torch/nn/functional.py&quot;, line 4017, in _pad
    return torch._C._nn.reflection_pad2d(input, pad)
RuntimeError: &quot;reflection_pad2d&quot; not implemented for 'Byte'

What do you think is the problem? I can't figure it out. Thanks in advance.

You need to change data type of your img to float e.g. img.float(). Many operations such as reflection_pad2d are implemented only for float tensors.
