gradient for generative model
complete DLGM (to be tested)