Check you code for inplace operations such as x += y or all operations with a trailing underscore: e.g. x.copy_() and replace them with the out of place equivalent.
If you cannot find these operations, could you post the model definition?