Solved by albanD in post #4 
              
              
                Because out here is the output of a batchnorm layer, and batchnorm layer does not require it’s output to be able to perform the backward pass. So you can modify it inplace without any problem.