I don’t see any inplace operations in the posted code, so I guess the error might be raised by an inplace op in the models.
Did you enable anomaly detection and rerun the code?
If so, could you post the complete stack trace here?