This gets back to the original problem I posted about. I can’t get the numpy ndarray of the output tensor from the model without detaching it first, but I need the numpy ndarray of the tensor to compute the gradients of the loss.
RuntimeError: Can't call numpy() on Tensor that requires grad. Use tensor.detach().numpy() instead.

There is a second problem here in that the graph of the network I am training needs to be reattached to the outout_pred and training_pred variables in the code sample above.
Perhaps what I am trying to do (use the output of a separate NN run on the output of the network I am training and the training sample and compute the MSE loss between these two outputs) is impossible given how back-propagation works, but unfortunately I don’t know enough about back-propagation calculations to answer this definitively.