VAE on Cifar10 dataset using CNN

I got stuck due to this error. I try to resolve it in many ways but I can’t.
Please anyone help me to solve it effectively

link of code:- https://drive.google.com/open?id=1SqN6ruqdmWg_Y7rd_S_n-bKTtCACDKkr

Most likely this error is thrown because esp is still on the CPU while mu and std seem to be calculated by the linear layers and might thus be on the GPU (if the model was pushed to the GPU of course).

Try to create esp using the device argument of mu:

esp = torch.randn(*mu.size(), device=mu.device)
1 Like

Thank u for solution…it solve my error very easily…

Can u pls tell me why my loss is coming negative. And my output is very bad…any suggestion.