I have a resnet that uses convolutions and nn.ReflectionPad1D. The data that I have is 1D (1045 long) with 2 channels (real and imaginary). All of the padding layers are defined using an integer, so the built-in functions convert that into a paired tuple, i.e. equal padding on both sides of the 1D vector. When I check the dimensions of the input using “input.dim()”, it of course equals 2: [1045, 2].
Here is the relevant portion of the error message:

File “/home/john/Documents/Research/GAN/modules/loss_networks.py”, line 112, in setup
input = autograd.Variable(gen(input).data)
File “/home/john/.local/lib/python3.6/site-packages/torch/nn/modules/module.py”, line 477, in call
result = self.forward(*input, **kwargs)
File “/home/john/Documents/Research/GAN/modules/generator_networks.py”, line 63, in forward
return self.model(input)
File “/home/john/.local/lib/python3.6/site-packages/torch/nn/modules/module.py”, line 477, in call
result = self.forward(*input, **kwargs)
File “/home/john/.local/lib/python3.6/site-packages/torch/nn/modules/container.py”, line 91, in forward
input = module(input)
File “/home/john/.local/lib/python3.6/site-packages/torch/nn/modules/module.py”, line 477, in call
result = self.forward(*input, **kwargs)
File “/home/john/.local/lib/python3.6/site-packages/torch/nn/modules/padding.py”, line 163, in forward
return F.pad(input, self.padding, ‘reflect’)
File “/home/john/.local/lib/python3.6/site-packages/torch/nn/functional.py”, line 2181, in pad
raise NotImplementedError(“Only 3D, 4D, 5D padding with non-constant padding are supported for now”)
NotImplementedError: Only 3D, 4D, 5D padding with non-constant padding are supported for now
Process finished with exit code 1

I looked at the source code and it says that 1D padding using reflection/replicaiton requires a 3D input tensor. I thought the point of nn.Reflection1DPad was to pad a 1D tensor, so I don’t understand why it requires a 3D input.
Can someone please explain what I am doing wrong? If you need anymore information (code, etc.), I’ll be happy to provide whatever you need.
Thank you in advance.