Could you explain what each of the dimensions represent?
Also, if I’m not mistaken, the KL divergence term contains the log of the probability distribution so if you were to add in zeros you’re effectively adding in negative infinity to your data which is going to cause a problem when backpropagating your loss.