The exactly same codes in two different projects result a Tensor to different device?

I am confused about which device would a Tensor comes from when creating a new Tensor?
I am using a piece of exactly same code in two different projects. In one project, ‘self.priors = torch.Tensor(prior_data).view(-1, 4)’, self.priors is on GPU. But for the other project, self.priors is on CPU.
What’s the reason? The two pieces of code are completely same.

This is most likely because either set_default_tensor_type or set_default_dtype has been called in one project and not the other.

Oh, yes. I missed ‘set_default_tensor_type’ in one project. Thank you.