yunjey / pytorch-tutorial

PyTorch Tutorial for Deep Learning Researchers
MIT License
29.94k stars 8.1k forks source link

about VAE (why should we save the image?) #201

Closed JingsenZhang closed 4 years ago

JingsenZhang commented 4 years ago

I don't understand when doing training why we should save the sampled image and reconstructed image in every epoch. Just like this.

with torch.no_grad():

Save the sampled images

    z = torch.randn(batch_size, z_dim).to(device)
    out = model.decode(z).view(-1, 1, 28, 28)
    save_image(out, os.path.join(sample_dir, 'sampled-{}.png'.format(epoch+1)))

    # Save the reconstructed images
    out, _, _ = model(x)
    x_concat = torch.cat([x.view(-1, 1, 28, 28), out.view(-1, 1, 28, 28)], dim=3)
    save_image(x_concat, os.path.join(sample_dir, 'reconst-{}.png'.format(epoch+1)))

AND I have tried the code without the part above,There's not much of a difference about the results.

who can help me? Thank you very very much!

OrangeC93 commented 4 years ago

Just save interim output for people to see and compare? I don't think there're any influence on the model performance.

JingsenZhang commented 4 years ago

I got it.

Thank you very much!

Jason

邮箱:18742521286@163.com |

Signature is customized by Netease Mail Master

On 12/10/2019 06:29, OrangeC93 wrote:

Just save interim output for people to see and compare? I don't think there're any influence on the model performance.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.