Torch.jit.trace device

I know inputs and model must be the same type, cpu or cuda.That is to say they must be on the same device.However,what’s the difference?
ON CPU:

    best_model = torch.load('checkpoints/test.pth')
    device = torch.device("cpu")
    best_model.to(device)
    example = torch.rand(1, 3, 256, 256)
    traced_script_module = torch.jit.trace(best_model, example)
    traced_script_module.save("test_cpu.pt")

ON CUDA:

    best_model = torch.load('checkpoints/test.pth')
    best_model.cuda()
    example = torch.rand(1, 3, 256, 256).cuda()
    traced_script_module = torch.jit.trace(best_model, example)
    traced_script_module.save("test_gpu.pt")

Both the above codes can transfer a model to a torch script.I am wondering what’s difference between the two methods.
Thank you for your attention.