Hi, I did put cuda synchronize before, is that enough?
but unfortunately, the difference between the tracing log and the printed report still big (only cuda total). It seems for me that in the printed report, the cuda total time just sum up all the items in the table without considering some of the processes are of subprocess of other processes(for example, the first item in the table is the whole inference time consumption). so it over-calculated the time. Does that make sense to you? thanks!
torch.cuda.synchronize(), 
with torch.autograd.profiler.profile(use_cuda=True) as prof:
        out_test = model_test(img)
print('test time is ', prof)