pytorch-cpp icon indicating copy to clipboard operation
pytorch-cpp copied to clipboard

test speed

Open jjn037 opened this issue 7 years ago • 3 comments

Have you tested the speed? I get a lower speed(30ms/img) with resnet18 224*224 bachsize1

jjn037 avatar Jan 31 '18 02:01 jjn037

auto output_tensor = CPU(kByte).tensorFromBlob(data, {output_height, output_width, 3});

spend an abnormal time

jjn037 avatar Jan 31 '18 13:01 jjn037

Sorry for the late reply

@jjn037 This piece of code is slow because you transfer the data from gpu to cpu -- this is usually an expensive operation and should be slow in the original pytorch too.

Would be cool if you can compare the timing of the cpp line with a pytorch's one: output.cpu() and see if there is a significant difference in runtime

warmspringwinds avatar Feb 06 '18 22:02 warmspringwinds

FYI, I have just added a file with a speed benchmark: https://github.com/warmspringwinds/pytorch-cpp/blob/master/examples/resnet_18_8s_benchmark.cpp

warmspringwinds avatar Apr 26 '18 20:04 warmspringwinds