Interesting.
There must be another place in your code where you do inplace operations. By setting a subtensor with x[smth] =  or using +=  or using inplace pytorch ops (usually with a trailing underscore like mul_() )