Change this in your code.
 def __init__(self):
        super().__init__()
        self.fc1=nn.Linear(116,500)
        self.hidden = nn.Linear(505,500)
        self.mu = nn.Linear(500,25)
        self.sigma = nn.Linear(500,25)
        
        self.fc2 = nn.Linear(25,495)
        self.fc3 = nn.Linear(500,116)
        self.sigmoid = nn.Sigmoid()
        self.relu = nn.ReLU()

This caused the earlier error.



 Mi_Rak:

My misundertand is that the shape show that y = (no_sample, 1), but it returns (no_sample, 5)