Your current script tries to profile the host to device transfer time, which wouldn’t work, since CUDA operations are asynchronous, so you would need to synchronize the code via torch.cuda.synchronize() before starting and stopping the timer.
To profile the data loading, you could use the data_time object from the ImageNet example 1.