Thanks for the information.
Note that CUDA operations are asynchronous, so you would have to synchronize the code via torch.cuda.synchronize() before starting and stopping the timer.
Could you add it and time the codes again?
I don’t know, how TF handles this case and how to synchronize TF code.