Thank you, I really didn’t know about that…
The input tensor x can vary from dataset to dataset but its dimensions stay constant on each run. Because of this, I managed to remove the l layer from the class entirely and instead set the input dimension on the first linear layer of the perceptron as the product of the last kernel size of the constitutional layer and the number of features. It seemed to still work but the network keeps getting stuck around the same values.
I also tried to run the same code in a different dataset and I still get the same results.
The code now is:
class model(nn.Module):
    def __init__(self,c_channels,char_size):
        super(model, self).__init__()
        self.last_kernel = 3
        self.p_channels = self.last_kernel*char_size
        self.convolutions = nn.Sequential(
            nn.Conv1d(c_channels, 500, kernel_size=7, stride=1, padding=1),
            nn.ReLU(),
            nn.MaxPool1d(kernel_size=3),
            nn.Conv1d(500, 400, kernel_size=7, stride=1, padding=1),
            nn.ReLU(),
            nn.MaxPool1d(kernel_size=3),
            nn.Conv1d(400, 300, kernel_size=3, stride=1, padding=1),
            nn.ReLU(),
            nn.Conv1d(300, 200, kernel_size=3, stride=1, padding=1),
            nn.ReLU(),
            nn.Conv1d(200, 100, kernel_size=3, stride=1, padding=1),
            nn.ReLU(),
            nn.MaxPool1d(kernel_size=self.last_kernel),
            )
        self.perceptron = nn.Sequential(
            nn.Linear(self.p_channels,50),
            nn.Sigmoid(),
            nn.Linear(50,16),
            nn.Sigmoid(),
            nn.Linear(16,1),
            nn.Sigmoid()
        )
        #self.transfer = lambda x,y: nn.Linear(x,y)
    def forward(self, x):
        x = self.convolutions(x)
        x = x.view(x.size(0), -1)
        print(x.shape)
        #l = self.transfer(x.shape[1],self.perceptron[0].in_features)
        #x = self.perceptron(l(x))
        x = self.perceptron(x)
        return x