Using the gradient of wrt the input in the loss function

I think this is related, ping @avikpal