Solved by albanD in post #2 
              
              
                This is because the gradients wrt P_NG and NP_G are not 0. And these are computed in a differentiable manner wrt output. So you get some gradients for your output.