Check the doc, https://pytorch.org/docs/stable/nn.html#torch.nn.ConstantPad1d 208, input should be like (N, C, W_{int}). The first dimension should be batch size, in you case N=1 so just reshape the input.