SimonW:

torch.nn.ReplicationPad1d


Thanks a lot, dude. You mean sth. like this:
class ascadCNNbest(nn.Module):

    def __init__(self, num_classes):
        """ Constructor
        Args:
            num_classes: number of classes
        """
        super(ascadCNNbest, self).__init__()

        self.num_classes = num_classes
        self.traceLen = traceLen

        self.conv1 = nn.Conv1d(1, 64, kernel_size=11, stride=1, padding=0)
        self.pad1 = nn.ReflectionPad1d(5)
        self.conv2 = nn.Conv1d(64, 128, kernel_size=11, stride=1, padding=0)
        self.pad2 = nn.ReflectionPad1d(5)
        self.conv3 = nn.Conv1d(128, 256, kernel_size=11, stride=1, padding=0)
        self.pad3 = nn.ReflectionPad1d(5)
        self.conv4 = nn.Conv1d(256, 512, kernel_size=11, stride=1, padding=0)
        self.pad4 = nn.ReflectionPad1d(5)
        self.conv5 = nn.Conv1d(512, 512, kernel_size=11, stride=1, padding=0)
        self.pad5 = nn.ReflectionPad1d(5)

        self.fc1 = nn.Linear(10752, 4096)
        self.fc2 = nn.Linear(4096, 4096)
        self.fc3 = nn.Linear(4096, num_classes)


    def forward(self, x):
        out = F.relu(self.pad1(self.conv1(x)))
        out = F.avg_pool1d(out, 2)

        out  = F.relu(self.pad2(self.conv2(out)))
        out = F.avg_pool1d(out, 2)

        out = F.relu(self.pad3(self.conv3(out)))
        out = F.avg_pool1d(out, 2)

        out = F.relu(self.pad4(self.conv4(out)))
        out = F.avg_pool1d(out, 2)

        out = F.relu(self.pad5(self.conv5(out)))
        out = F.avg_pool1d(out, 2)

        out = out.view(out.size(0), -1)
        out = F.relu(self.fc1(out))
        out = F.relu(self.fc2(out))
        out = self.fc3(out)

        return out