The toc counter isn’t synchronized, so while the GPU is busy in net(ran.float()), you are immediately stopping the time, print the profiling result, synchronize (and thus wait until the GPU is finished), start the time and stop it immediately after a few iterations.
Try to add another torch.cuda.synchronize() before the toc call and rerun the code.