alexobrads:

diff = (y1 - y2)**2 * ivar.numpy()


Hey, Alex. Hope you good.
This specific line got my attention. By all means I´m not an expert , only just a PyTorch beginner. But  having spent much of my PyTorch time with VAEs I´ll give it a shout. So:


The way I see it you are forcing your decoder not to reconstruct your loss. Your are transforming y1 and y2 by detaching (detaching the gradient) and then numpyi-ing it (yes, I want to make this word trendy. ) So definitively, there wont be any reconstruction loss in your diff variable, because there is no gradients in diff, and without reconstruction, the VAE will make just  effort to make things right by the KL term, a compression of information, no generative aspects of the  algo.


Question:  What is it fl, fl_sample? And why do you think is necessary to detach() and numpy it? So my suggestion is to let diff, y1 and y2 as tensors.


My best regards,