<h2 dir="auto"><g-emoji class="g-emoji" alias="bug" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f41b.png">🐛</g-emoji> Bug</h2>
<p dir="auto"><code class="notranslate">torch.Tensor</code> is creating tensor only on CPU. The <code class="notranslate">device</code> argument isn't working</p>
<h2 dir="auto">To Reproduce</h2>
<p dir="auto">Steps to reproduce the behavior:</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/932927/46579323-e5c9dd00-c9dc-11e8-93e6-5ee08db479ec.png"><img width="704" alt="screen shot 2018-10-07 at 2 58 28 am" src="https://user-images.githubusercontent.com/932927/46579323-e5c9dd00-c9dc-11e8-93e6-5ee08db479ec.png" style="max-width: 100%;"></a></p>
<h2 dir="auto">Expected behavior</h2>
<p dir="auto"><code class="notranslate">torch.Tensor</code> should create tensor on <code class="notranslate">cuda:0</code> device</p>
<h2 dir="auto">Environment</h2>
<p dir="auto">Google Colaboratory + Python 3 + GPU</p>
<p dir="auto">Collecting environment information...<br>
PyTorch version: 0.4.1<br>
Is debug build: No<br>
CUDA used to build PyTorch: 9.0.176</p>
<p dir="auto">OS: Ubuntu 17.10<br>
GCC version: (Ubuntu 7.2.0-8ubuntu3.2) 7.2.0<br>
CMake version: Could not collect</p>
<p dir="auto">Python version: 3.6<br>
Is CUDA available: Yes<br>
CUDA runtime version: Could not collect<br>
GPU models and configuration: GPU 0: Tesla K80<br>
Nvidia driver version: 384.111<br>
cuDNN version: Could not collect</p>
<p dir="auto">Versions of relevant libraries:<br>
[pip] Could not collect<br>
[conda] Could not collect</p>
<h2 dir="auto">Issue description</h2>
<p dir="auto">torch.LongTensor silently ignores <code class="notranslate">device='cuda'</code> parameter</p>
<h2 dir="auto">Code example</h2>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import torch

i = torch.LongTensor(3, device='cuda')
assert i.is_cuda"><pre class="notranslate"><code class="notranslate">import torch

i = torch.LongTensor(3, device='cuda')
assert i.is_cuda
</code></pre></div>
<p dir="auto">Output:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Traceback (most recent call last):
  File &quot;tmp_prog/test.py&quot;, line 4, in &lt;module&gt;
    assert i.is_cuda
AssertionError"><pre class="notranslate"><code class="notranslate">Traceback (most recent call last):
  File "tmp_prog/test.py", line 4, in &lt;module&gt;
    assert i.is_cuda
AssertionError
</code></pre></div>
<h2 dir="auto">System Info</h2>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="PyTorch version: 0.4.1
Is debug build: No
CUDA used to build PyTorch: 9.0.176

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

Python version: 3.6
Is CUDA available: Yes
CUDA runtime version: 9.0.176
GPU models and configuration: GPU 0: Tesla M60
Nvidia driver version: 384.130
cuDNN version: Probably one of the following:
/usr/lib/x86_64-linux-gnu/libcudnn.so.5.1.10
/usr/lib/x86_64-linux-gnu/libcudnn.so.6.0.21
/usr/lib/x86_64-linux-gnu/libcudnn.so.7.0.3
/usr/lib/x86_64-linux-gnu/libcudnn_static_v5.a
/usr/lib/x86_64-linux-gnu/libcudnn_static_v6.a
/usr/lib/x86_64-linux-gnu/libcudnn_static_v7.a

Versions of relevant libraries:
[pip] numpy (1.14.3)
[pip] torch (0.4.1)
[pip] torchtext (0.2.3)
[pip] torchvision (0.2.1)
[conda] pytorch                   0.4.1           py36_cuda9.0.176_cudnn7.1.2_1    pytorch
[conda] torchtext                 0.2.3                     &lt;pip&gt;
[conda] torchvision               0.2.1                    py36_1    pytorch"><pre class="notranslate"><code class="notranslate">PyTorch version: 0.4.1
Is debug build: No
CUDA used to build PyTorch: 9.0.176

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

Python version: 3.6
Is CUDA available: Yes
CUDA runtime version: 9.0.176
GPU models and configuration: GPU 0: Tesla M60
Nvidia driver version: 384.130
cuDNN version: Probably one of the following:
/usr/lib/x86_64-linux-gnu/libcudnn.so.5.1.10
/usr/lib/x86_64-linux-gnu/libcudnn.so.6.0.21
/usr/lib/x86_64-linux-gnu/libcudnn.so.7.0.3
/usr/lib/x86_64-linux-gnu/libcudnn_static_v5.a
/usr/lib/x86_64-linux-gnu/libcudnn_static_v6.a
/usr/lib/x86_64-linux-gnu/libcudnn_static_v7.a

Versions of relevant libraries:
[pip] numpy (1.14.3)
[pip] torch (0.4.1)
[pip] torchtext (0.2.3)
[pip] torchvision (0.2.1)
[conda] pytorch                   0.4.1           py36_cuda9.0.176_cudnn7.1.2_1    pytorch
[conda] torchtext                 0.2.3                     &lt;pip&gt;
[conda] torchvision               0.2.1                    py36_1    pytorch
</code></pre></div>