GPU profiling has shown that the kinds of CUDA kernels that run internally are different between python and C++.
Python

models.densenet201(pretrained=True).cuda().eval()


torch.jit.load(“densenet201_model.pt”).cuda().eval()

C++

torch::jit::load(“densenet201_model.pt”);

The above three results and the layers running are the same, but the types and numbers of CUDA kernels running internally are all different.
There were more kernel types running on python.
What’s the reason for this result?