The gradients won’t be computed unless the model exposes the gradient computation tasks as a model structure. The above example shows how to include the gradient computations into a model signature and compute the gradients on device.