If you create a plain Variable, it won’t require gradients.
Did you set requires_grad=True in the __getitem__ method of your Dataset?
If so, could you remove it and check the time again?
Also, note that CUDA calls are asynchronous. If you are using a GPU as device, you should synchronize the code before starting and stopping the timer using:
torch.cuda.synchronize()
t1 = time.perf_counter()
...
torch.cuda.synchronize()
t2 = time.perf_counter()