Solved by ptrblck in post #2 
              
              
                If you are using the GPU, note that CUDA operations are asynchronous, so that you should call torch.cuda.synchronize() before starting and stopping the timer.