Fail to redirect my output when using torch.device

When I call the following code:
device = torch.device(“cuda:0” if torch.cuda.is_available() else “cpu”)
My output redirection doesn’t work, i.e., when I cat my .out file, there’s nothing in it. Could someone help me?

Could you explain your use case a bit?
It seems you are trying to save some tensors in a file which is not working?
Is it working with CPU tensors?