How to change the default device of GPU? device_ids[0]

This is a very useful solution, especially you are going to run with someone else’s code without specifying the cuda id.