You could try to use the device property of another parameter:
class MyModule(nn.Module):
    def __init__(self):
        super(MyModule, self).__init__()
        self.fc1 = nn.Linear(1, 1)
    
    def forward(self, x):
        return x
    
    def get(self):
        device = self.fc1.weight.device
        var1 = nn.Parameter(torch.randn(1, device=device))
        return var1



model = MyModule()
v1 = model.get()
print(v1.device)
> cpu

model = model.to('cuda')
v2 = model.get()
print(v2.device)
> cuda:0

If you don’t have any Parameters registered in your Module, you could pass the device as an argument alternatively.