If I understand your question correctly, you would like to implement a moving average filter for 1D input?
You could use a convolution with directly specified weights and apply it on your signal.
Try this code:
x = torch.randn(1, 1, 100)

mean_conv = nn.Conv1d(in_channels=1,
                      out_channels=1,
                      kernel_size=5)

# Set kernel to calculate mean
kernel_weights = np.array([1., 1., 1., 1., 1.])/5
mean_conv.weight.data = torch.FloatTensor(kernel_weights).view(1, 1, 5)
output = mean_conv(Variable(x))

output.shape will be [1, 1, 96] since we did not use padding.