Assuming you are running this code snippet on both machines, I would recommend to check the intermediate tensors such as the output as well as the output activations using hooks.
If I’m not mistaken, forward hooks are not available in libtorch yet, so you could use the Python frontend.