Yes I already try this but with the same error
def encoder(self,x, y):
        h = self.relu(self.fc1(x))
        h1 = torch.cat((h, y), dim = 1)
        temp_h1 = self.relu(self.hidden(h1))
        return self.mu(temp_h1),self.sigma(temp_h1)

builtins.RuntimeError: size mismatch, m1: [512 x 517], m2: [512 x 517] at c:\a\w\1\s\windows\pytorch\aten\src\th\generic/THTensorMath.cpp:940
My misundertand is that the shape show that y = (no_sample, 1), but it returns (no_sample, 5)