RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.cuda.FloatTensor [3, 3, 3, 3]] is at version 3; expected version 2 instead

Why RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation ?

The strange thing is that if I set DEBUG = 1 , then the inplace runtime error is gone, why ??