Measuring the time of model transfer and image classification

Hi All. I want to transfer my model from the CPU to GPU and also measure the time it takes to classify an image. I am using a pre trained AlexNet for this purpose. I am dong it as follows :

t1 = time.time()
t2 = time.time()
t3 = time.time()

Is this the correct way to do it ? For example, will t2-t1 tell me the model transfer time or it will just start the model transfer to the GPU and while that happens in the background and it will move forward with the code ? Thanks :slight_smile: