Are you using the CPU only or also a GPU?
In the latter case, are you synchronizing the code? Since CUDA operations are asynchronous, you would have to synchronize the code via torch.cuda.synchronize() to get a valid profiling result.
If you are using a GPU, do both machines have the same GPU, CUDA, and cudnn version?
Also, how did you install PyTorch on these machines? Did you build from source or installed a binary?
Are both PyTorch versions equal?