BTW variable is deprecated since pytorch 0.4
Besides, I think that
elbo_loss = Variable(kl_qp - sum_mean_log_prob, requires_grad=True)

This line breaks the computational graph as you are reinitilizing that parameter from kl-sum data