nk00:

I’m still confused about z though. Do I have to define a separate case for training and testing, eg




Logically you don’t need any separate case. You can just use the code block given in the pytorch code. (Depends on what you want. If I want to send some sample I will use something like this)
Method I:
 zsample = torch.randn(64, 20).to(device)
 zsample = model.decode(zsample).cpu()

Method II:
(The reparam function only comes into picture if you pass something as a Input to encoder then it will generate z,mu,logavar using reparm trick then it will take the z and pass to decoder to produce output image). (Usually people don’t do this they just just take decoder and pass what they want)