Could you post the forward method of your model?
It seems your output gets detached somehow, e.g. by calling detach() directly on a tensor or by leaving PyTorch and using some other library like numpy.
If it’s possible the whole model code would be interesting to see, too.
As a small side note, you shouldn’t call the forward method of your model, but the model directly instead: model(inputs).