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
Input type (torch.FloatTensor) and weight type (torch.cuda.FloatTensor) should be the same #52
Comments
I'm pretty sure |
So it's impossibile to run on GPU or i missed something? |
Are you serious? Did you even try |
Sorry, i didn't understand your answer. Thank you very much,, |
The problem is that you didn't convert the type of the input data correctly. You can try something like this: |
hi, do you solve this problem? |
I just wrote
As wrote before, sending tensor to device is not inplace operation and it returns new tensor. |
Hi there! Thanks for your great repo, but i faced with some difficulties while trying to inference on device ('cuda:0'). My code:
device = torch.device('cuda:0')
tfms = transforms.Compose([transforms.Resize(224), transforms.ToTensor(), transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225]),])
img = tfms(Image.open('img.png')).unsqueeze(0)
img.to(device)
model.to(device)
model.eval()
with torch.no_grad(): outputs = model(img)
And thrown error:
RuntimeError: Input type (torch.FloatTensor) and weight type (torch.cuda.FloatTensor) should be the same
The text was updated successfully, but these errors were encountered: