Solved by jpeg729 in post #4 
              
              
                Yes, but it only depends on the gradient with respect to the input of D, it does not depend on the gradient with respect to the parameters of D.