Globally set the device

Is there a way to globally set the default device with libtorch?
I know there exists device guard implemented here:

But it won’t set it globally and it’s harder to program with when the user can dynamically decide to set it or not.

I wonder if there’s something equivalent to torch::autograd::GradMode::set_enabled(enabled) that we can use to set the grad mode globally.