Problem defining a Neural Network with gradient as Loss function

Without an MWE that includes enough of NNsolver to trigger the error, we won’t have enough information to help you troubleshoot this. A full stack trace would be very much appreciated as well.