Net test speed is so confusing

hello, I meet some issue to test the net speed.
the following is my test code
tic = time.time()
result = net(image)
toc = time.time()
duration = toc - tic

The net is composed of vgg16 (no fc) and followed with 2 sub-fc, but the time to test a image is just about 0.001, much quick than reality, which supposed to be 10 fps. What’s wrong with it? And how to test the net speed correctly?

You need to synchronize before stopping the timer, since CUDA calls are called asynchronously.

result = net(image)
torch.cuda.synchronize()
toc = time.time()
1 Like

Oh, Thanks you very much! Have a good day!