Skip to content

EmbeddingBag raises RuntimeError if input is on the wrong device  #7689

@nikitakit

Description

@nikitakit

Issue description

EmbeddingBag raises a RuntimeError if its weights are on the GPU, but the input is on the CPU.

Code example

import torch
bow = torch.nn.EmbeddingBag(10, 10).cuda()
test = torch.tensor([[1, 2]], dtype=torch.long).cpu()
bow(test)

Result: RuntimeError: get_device is not implemented for type torch.LongTensor
Expected result: a more informative error about device mismatch

System Info

PyTorch version: 0.4.0
Is debug build: No
CUDA used to build PyTorch: 9.0.176

OS: Ubuntu 16.04.3 LTS
GCC version: (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
CMake version: version 3.5.1

Python version: 3.6
Is CUDA available: Yes
CUDA runtime version: Could not collect
GPU models and configuration:
GPU 0: Quadro GP100
GPU 1: Quadro GP100

Nvidia driver version: 384.81
cuDNN version: Could not collect

Versions of relevant libraries:
[pip] numpy (1.14.3)
[pip] torch (0.4.0)
[pip] torchvision (0.2.1)
[conda] cuda90 1.0 h6433d27_0 pytorch
[conda] pytorch 0.4.0 py36_cuda9.0.176_cudnn7.1.2_1 [cuda90] pytorch
[conda] torchvision 0.2.1 py36_1 pytorch

Metadata

Metadata

Assignees

No one assigned

    Labels

    todoNot as important as medium or high priority tasks, but we will work on these.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions