Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Runtime error when you try to create a tensor using arg "devcie ='cuda' in ContinuousDiceStateActionWightValueLearning #31

Open
xiaobaijh opened this issue Apr 22, 2024 · 1 comment

Comments

@xiaobaijh
Copy link

In classs ContinuousDiceStateActionWightValueLearning ,line 400 we use state = torch.FloatTensor(state, device=self.device) to create a tensor,but if self.device is 'cuda',it will throw error
'RuntimeError: legacy constructor expects device type: cpu but device type: cuda was passed',it should be state = torch.tensor(state, device=self.device).So as the other tensors in this class.

@malone-c
Copy link

malone-c commented Aug 26, 2024

+1 on this issue. This is preventing me from fitting weight functions on GPU using either the DICE or MWL methods.

The torch.FloatTensor function is an outdated part of the legacy API. See here for example: https://discuss.pytorch.org/t/cannot-construct-tensor-directly-on-gpu-in-torch-1-10-1/153751/2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants