Hi,
Keep in mind that the cuda api is asynchronous and only synchronize if you ask for it explicitly with torch.cuda.synchronize() or if you read some value back to the cpu (by calling .cpu() for example).
So the timing you measure here for the line that contains .cpu() is actually the time of doing all computations + sending the tensor back.