Your kernel shape in kn is wrong, as nn.Conv2d uses a weight with the shape [out_channels, in_channels, height, width].
This code should work:
kn = torch.Tensor([[1 ,0, -1],[2, 0 ,-2], [1, 0 ,-1]]).unsqueeze(0).unsqueeze(0)

class ConvolutionalNetwork(nn.Module):
    def __init__(self):
        super().__init__()
        self.conv1 = nn.Conv2d(3,6,kernel_size=(3,3), stride=1, padding=1, bias=False)
        self.conv1.weight = nn.Parameter(kn.expand(6, 3, -1, -1))
        self.conv2 = nn.Conv2d(6, 16, kernel_size=(3,3), stride=1, padding=1, bias=False)
        self.conv2.weight = nn.Parameter(kn.expand(16, 6, -1, -1))
        self.fc1 = nn.Linear(56*56*16, 120)
        self.fc2 = nn.Linear(120, 84)
        self.fc3 = nn.Linear(84, 18)
    
    def forward(self, X):
            X = F.relu(self.conv1(X))
            X = F.max_pool2d(X, 2, 2)#max pooling de 2x2
            X = F.relu(self.conv2(X))
            X = F.max_pool2d(X, 2, 2)
            X = X.view(-1, 56*56*16)
            X = F.relu(self.fc1(X))
            X = F.relu(self.fc2(X))
            X = self.fc3(X)
            return F.log_softmax(X, dim=1)
torch.manual_seed(101)
CNNmodel = ConvolutionalNetwork()

x = torch.randn(1, 3, 224, 224,)
out = CNNmodel(x)

PS: I’ve formatted your post for easier debugging. You can add code snippets by wrapping them in three backticks ```