title: RuntimeError: CUDA error: no kernel image is available for execution on the device
body: <p>CUDA error with pytorch</p>
  
  <p>Installed pytorch with conda and CUDA support</p>
  
  <p>The error occurs when I am trying to run a tensor on the cuda gpu</p>
  
  <pre><code>torch.rand(10).to(torch.device('cuda'))
  
  RuntimeError Traceback (most recent call last)
  ~/anaconda3/envs/deep/lib/python3.7/site-packages/IPython/core/formatters.py in call(self, obj)
  700 type_pprinters=self.type_printers,
  701 deferred_pprinters=self.deferred_printers)
  --&gt; 702 printer.pretty(obj)
  703 printer.flush()
  704 return stream.getvalue()
  
  ~/anaconda3/envs/deep/lib/python3.7/site-packages/IPython/lib/pretty.py in pretty(self, obj)
  397 if cls is not object
  398 and callable(cls.dict.get('repr')):
  --&gt; 399 return _repr_pprint(obj, self, cycle)
  400
  401 return _default_pprint(obj, self, cycle)
  
  ~/anaconda3/envs/deep/lib/python3.7/site-packages/IPython/lib/pretty.py in repr_pprint(obj, p, cycle)
  687 """A pprint that just redirects to the normal repr function."""
  688 # Find newlines and replace them with p.break()
  --&gt; 689 output = repr(obj)
  690 for idx,output_line in enumerate(output.splitlines()):
  691 if idx:
  
  ~/anaconda3/envs/deep/lib/python3.7/site-packages/torch/tensor.py in repr(self)
  128 # characters to replace unicode characters with.
  129 if sys.version_info &gt; (3,):
  --&gt; 130 return torch._tensor_str._str(self)
  131 else:
  132 if hasattr(sys.stdout, 'encoding'):
  
  ~/anaconda3/envs/deep/lib/python3.7/site-packages/torch/_tensor_str.py in _str(self)
  309 tensor_str = _tensor_str(self.to_dense(), indent)
  310 else:
  --&gt; 311 tensor_str = _tensor_str(self, indent)
  312
  313 if self.layout != torch.strided:
  
  ~/anaconda3/envs/deep/lib/python3.7/site-packages/torch/_tensor_str.py in _tensor_str(self, indent)
  207 if self.dtype is torch.float16 or self.dtype is torch.bfloat16:
  208 self = self.float()
  --&gt; 209 formatter = _Formatter(get_summarized_data(self) if summarize else self)
  210 return _tensor_str_with_formatter(self, indent, formatter, summarize)
  211
  
  ~/anaconda3/envs/deep/lib/python3.7/site-packages/torch/_tensor_str.py in init(self, tensor)
  85
  86 else:
  ---&gt; 87 nonzero_finite_vals = torch.masked_select(tensor_view, torch.isfinite(tensor_view) &amp; tensor_view.ne(0))
  88
  89 if nonzero_finite_vals.numel() == 0:
  
  ~/anaconda3/envs/deep/lib/python3.7/site-packages/torch/functional.py in isfinite(tensor)
  225 if not tensor.is_floating_point():
  226 return torch.ones_like(tensor, dtype=torch.bool)
  --&gt; 227 return (tensor == tensor) &amp; (tensor.abs() != inf)
  228
  229
  
  RuntimeError: CUDA error: no kernel image is available for execution on the device
  </code></pre>
  
  <p>This is the collect_env.py output:</p>
  
  <p>Collecting environment information...</p>
  
  <p>PyTorch version: 1.3.1</p>
  
  <p>Is debug build: No</p>
  
  <p>CUDA used to build PyTorch: 10.0.130</p>
  
  <p>OS: Ubuntu 16.04.6 LTS</p>
  
  <p>GCC version: (Ubuntu 5.4.0-6ubuntu1~16.04.12) 5.4.0 20160609</p>
  
  <p>CMake version: version 3.5.1</p>
  
  <p>Python version: 3.7</p>
  
  <p>Is CUDA available: Yes</p>
  
  <p>CUDA runtime version: 10.0.130</p>
  
  <p>GPU models and configuration: GPU 0: GeForce 920M</p>
  
  <p>Nvidia driver version: 415.27</p>
  
  <p>cuDNN version: Could not collect</p>
  
  <p>Versions of relevant libraries:</p>
  
  <p>[pip] numpy==1.17.4</p>
  
  <p>[pip] numpy-stl==2.10.1</p>
  
  <p>[pip] torch==1.3.1</p>
  
  <p>[pip] torchvision==0.4.2</p>
  
  <p>[conda] blas 1.0 mkl</p>
  
  <p>[conda] mkl 2019.4 243</p>
  
  <p>[conda] mkl-service 2.3.0 py37he904b0f_0</p>
  
  <p>[conda] mkl_fft 1.0.15 py37ha843d7b_0</p>
  
  <p>[conda] mkl_random 1.1.0 py37hd6b4f25_0</p>
  
  <p>[conda] pytorch 1.3.1 py3.7_cuda10.0.130_cudnn7.6.3_0 pytorch</p>
  
  <p>[conda] torchvision 0.4.2 py37_cu100 pytorch</p>
  
  <p>Some have stated that the TORCH_CUDA_ARCH_LIST needs to be manually set to ='3.5', but I can't figure out how</p>