NaN occurred in optimization (error in DL with variational minibatches)

Have you tried the methods to debug in this post?