This paper fuses ideas from hierarchical graphical model and deep learning and performs efficient inference of cardiac transmural Transmembrane potential (TMP). Traditional algorithms in ECGi make use of the dynamics of electric propagation of wavefront inside heart by using electrophysiological (EP) model. While the EP model provides rich information, it comes with disadvantages like difficulty in simulataneous estimation of parameters, necessity to perform sequential estimate of TMP. In this paper, we resolve both of those problems by first learning a hierarchical graphical model whose conditional and prior probability distributions are learnt by using a deep neural network solely from the examples in an unsupervised way. Variational autoencoder is used for this purpose. Later, the learnt probability distributions are used to perform inference.