So i want to know if i can get the Kl divergence term from the loss.
The following code outputs the normalized loss per epoch of training:
for epoch in range(NUM_EPOCHS): epoch_loss=0 for x,label,_ in train_loader: epoch_loss += svi.step(x,label) # return normalized epoch loss normalizer_train = len(train_loader) total_epoch_loss_train = epoch_loss / normalizer_train
The loss is the negative ELB0, meaning : loss= -reconstuction term + KL(posterior|prior)
Is it any way to get also separately the KL ,when using
svi = SVI(vae.model, vae.guide, optimizer, loss = Trace_ELBO())