If the original code base works and you see this unwanted behavior, I would still recommend to triage the bug by removing your changed parts.
The error points to a (partly) frozen model. I’m not familiar with the use case, so it might be a red herring. Anyway, it might be a good starter for debugging.
We are aware of the higher memory usage due to some added functionalities in a tensor method and are thinking about different approaches to fix this.