How to add norm of gradient to a loss function?

As always, please include a full stacktrace along with your MWE.