ptrblck:

Is it a typo in the posted code or am I missing something, e.g. a push to the device in the forward method?


Good point. Interestingly, after running the program, if I do
a = torch.rand(1, 3, 300, 300)
a.type()

I get torch.cuda.FloatTensor(). Here is the relevant screenshot

image.png698×240 19.3 KB

Not sure, why this is happening. This is why it didn’t raise a bug even though it should have been a cpu tensor since it is residing in the gpu.



 ptrblck:

That means you should call torch.cuda.synchronize() before starting and stopping the timer.


Not sure if I am following you. Even if it was so, the same should happen for both of them.
I have added torch.cuda.synchronize() before both start and end time. The results are still the same unfortunately.

image.png705×85 9.12 KB

I have pushed the changes to git repo as well. (https://github.com/TheShadow29/ssd.pytorch 4)