Connect the MLP exit with the TCN entrance

Hy all, i have two model: a Multi Layer Perception and a Temporal convolutional Network.
Here the MLP:

class DeepMLPRegressor(nn.Module):
    def __init__(self, in_features, out_features):

        super(DeepMLPRegressor, self).__init__()

        self.model = nn.Sequential(nn.Linear(in_features, 32),
                                   nn.Linear(32, 64),
                                   nn.Linear(64, 128),
                                   nn.Linear(128, 64),
                                   nn.Linear(64, 32),
#this 16 with the entrance of TCN

    def forward(self, x):
        return self.model(x)

and here the TCN:

import torch
import torch.nn as nn
from torch.nn.utils import weight_norm

class Chomp1d(nn.Module):
    def __init__(self, chomp_size):
        super(Chomp1d, self).__init__()
        self.chomp_size = chomp_size

    def forward(self, x):
        return x[:, :, :-self.chomp_size].contiguous()

class TemporalBlock(nn.Module):
    def __init__(self, n_inputs, n_outputs, kernel_size, stride, dilation, padding, dropout=0.2):
        super(TemporalBlock, self).__init__()
        self.conv1 = weight_norm(nn.Conv1d(n_inputs, n_outputs, kernel_size,
                                           stride=stride, padding=padding, dilation=dilation))
        self.chomp1 = Chomp1d(padding)
        self.relu1 = nn.ReLU()
        self.dropout1 = nn.Dropout(dropout)

        self.conv2 = weight_norm(nn.Conv1d(n_outputs, n_outputs, kernel_size,
                                           stride=stride, padding=padding, dilation=dilation))
        self.chomp2 = Chomp1d(padding)
        self.relu2 = nn.ReLU()
        self.dropout2 = nn.Dropout(dropout) = nn.Sequential(self.conv1, self.chomp1, self.relu1, self.dropout1,
                                 self.conv2, self.chomp2, self.relu2, self.dropout2)
        self.downsample = nn.Conv1d(n_inputs, n_outputs, 1) if n_inputs != n_outputs else None
        self.relu = nn.ReLU()

    def init_weights(self):, 0.01), 0.01)
        if self.downsample is not None:
  , 0.01)

    def forward(self, x):
        out =
        res = x if self.downsample is None else self.downsample(x)
        return self.relu(out + res)

class TemporalConvNet(nn.Module):
    def __init__(self, num_inputs, num_channels, kernel_size=2, dropout=0.2):
        super(TemporalConvNet, self).__init__()
        layers = []
        num_levels = len(num_channels)
        for i in range(num_levels):
            dilation_size = 2 ** i
            in_channels = num_inputs if i == 0 else num_channels[i-1]
            out_channels = num_channels[i]
            layers += [TemporalBlock(in_channels, out_channels, kernel_size, stride=1, dilation=dilation_size,
                                     padding=(kernel_size-1) * dilation_size, dropout=dropout)] = nn.Sequential(*layers)

    def forward(self, x):

class TCN(nn.Module):
    def __init__(self, input_size, output_size, num_channels, kernel_size, dropout):
        super(TCN, self).__init__()
        self.tcn = TemporalConvNet(input_size, num_channels, kernel_size=kernel_size, dropout=dropout)
        self.linear = nn.Linear(num_channels[-1], output_size)

    def init_weights(self):, 0.01)

    def forward(self, x):
        y1 = self.tcn(x)
        return self.linear(y1[:, :, -1])

I create this class:

class FinalModel(nn.Module):
    def __init__(self, input_size, output_size):
        super(FinalModel, self).__init__()
        self.model1 = DeepMLPRegressor(input_size)
        self.model2 = TCN(input_size=16,  output_size=output_size, num_channels=[16],kernel_size = 2, dropout=0.25)

    def forward(self, x):

        x1 = self.model1(x)
        y = self.model2(x1)
        return y

I would like an output of 2.
I have this error:

RuntimeError: Expected 3-dimensional input for 3-dimensional weight [16, 16, 2], but got 2-dimensional input of size [16, 16] instead

Why the kernel size is a part of dimension and how can i connect in the right way the MLP exit with the TCN entrance?