Hello again,
def encoder(self,x, y):
        
        h = self.relu(self.fc1(x))
        print(h.size())
        h1 = th.cat((h, y), dim = 1)
        print(h1.size())
        h2 = self.relu(self.hidden(h1))
        return self.mu(h2),self.sigma(h2)

print size result
h = self.relu(self.fc1(x))
        print(h.size())
#torch.Size([512, 512])

and
h1 = th.cat((h, y), dim = 1)
        print(h1.size())
#torch.Size([512, 517])

So confusing, when I try to do like this, there are no problem but in this case , no y condition in the encoder network. My objective is to condition also CVAE encoder and decoder by y
def encoder(self,x):
        h = self.relu(self.fc1(x))
        h1 = self.relu(self.hidden(h))
        h2 = self.hidden(h1)
        return self.mu(h2),self.sigma(h2)

the difference
def encoder(self,x, y):
        h = self.relu(self.fc1(x))
        h1 = th.cat((h, y), dim = 1)
        h2 = self.relu(self.hidden(h1))
        return self.mu(h2),self.sigma(h2)