-
Notifications
You must be signed in to change notification settings - Fork 22.2k
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
Embedding on cuda fails #7236
Comments
The error states that it expects a |
I must be missing something:
|
|
Thanks. |
Issue description
Calling an Embedding moved to cuda fails.
The same code on CPU works.
Code example
import torch
import torch.nn as nn
e = nn.Embedding(17,50)
dev = torch.device('cuda')
e.to(dev, torch.float)
idx=torch.tensor([1,2,3])
e(idx)
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line 491, in call
result = self.forward(*input, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/sparse.py", line 108, in forward
self.norm_type, self.scale_grad_by_freq, self.sparse)
File "/usr/local/lib/python3.5/dist-packages/torch/nn/functional.py", line 107 6, in embedding
return torch.embedding(weight, input, padding_idx, scale_grad_by_freq, spars e)
RuntimeError: Expected object of type torch.cuda.LongTensor but found type torch .LongTensor for argument #3 'index'
System Info
PyTorch version: 0.4.0
Is debug build: No
CUDA used to build PyTorch: 9.1.85
OS: Ubuntu 16.04.4 LTS
GCC version: (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
CMake version: version 3.5.1
Python version: 3.5
Is CUDA available: Yes
CUDA runtime version: 8.0.61
GPU models and configuration:
GPU 0: Tesla P100-PCIE-16GB
GPU 1: Tesla P100-PCIE-16GB
GPU 2: Tesla P100-PCIE-16GB
GPU 3: Tesla P100-PCIE-16GB
Nvidia driver version: 390.30
cuDNN version: Probably one of the following:
/usr/lib/x86_64-linux-gnu/libcudnn.so.6.0.21
/usr/lib/x86_64-linux-gnu/libcudnn.so.7.0.5
/usr/lib/x86_64-linux-gnu/libcudnn_static_v7.a
/usr/local/MATLAB/R2017a/bin/glnxa64/libcudnn.so.5.1.5
Versions of relevant libraries:
[pip3] numpy (1.14.0)
[pip3] torch (0.4.0)
[pip3] torchvision (0.2.1)
The text was updated successfully, but these errors were encountered: