Kernel dies when moving model to cuda

When I attempt to move my model to cuda the kernel says the kernel has died. here is my code:
import torch.nn as nn
import torch.nn.functional as F

class Net(nn.Module):
def init(self):
super(Net, self).init()
self.conv1 = nn.Conv2d(3, 6, 5)
self.pool = nn.MaxPool2d(2, 2)
self.conv2 = nn.Conv2d(6, 16, 5)
self.fc1 = nn.Linear(16 * 5 * 5, 120)
self.fc2 = nn.Linear(120, 84)
self.fc3 = nn.Linear(84, 10)

def forward(self, x):
    x = self.pool(F.relu(self.conv1(x)))
    x = self.pool(F.relu(self.conv2(x)))
    x = x.view(-1, 16 * 5 * 5)
    x = F.relu(self.fc1(x))
    x = F.relu(self.fc2(x))
    x = self.fc3(x)
    return x

net = Net()
use_cuda = torch.cuda.is_available()
net.cuda()

When I print is use_cuda it says true which means it detects the gpu.
I am using a 2080 with cuda 10.1 and pytorch version 1.3.1
Any advice?

Could you rerun the script in the terminal and post the stack trace here, please?

I ran the script and I got this error message Segmentation fault (core dumped).

Could you run your code with gdb and try to get the stack trace as explained in this post?

Ok I did that here are the results:

Sorry I had to put them in different posts it wouldn’t let me put them in the same post because I am a new user. And when I enter the disas thing it says: No function contains program counter for selected frame.

Could you post the output as text and wrapping it into three backticks ```?
This would format the text and would make it easier to follow, what’s going on.

Starting program: /usr/bin/python3 cifar10_tutorial.py
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff373a700 (LWP 3201)]
[New Thread 0x7ffff2f39700 (LWP 3202)]
[New Thread 0x7fffee738700 (LWP 3203)]
[New Thread 0x7fffedf37700 (LWP 3204)]
[New Thread 0x7fffe9736700 (LWP 3205)]
[New Thread 0x7fffe8f35700 (LWP 3206)]
[New Thread 0x7fffe6734700 (LWP 3207)]
[Thread 0x7fffe6734700 (LWP 3207) exited]
[Thread 0x7fffe8f35700 (LWP 3206) exited]
[Thread 0x7fffe9736700 (LWP 3205) exited]
[Thread 0x7fffedf37700 (LWP 3204) exited]
[Thread 0x7fffee738700 (LWP 3203) exited]
[Thread 0x7ffff2f39700 (LWP 3202) exited]
[Thread 0x7ffff373a700 (LWP 3201) exited]
Files already downloaded and verified
Files already downloaded and verified
[New Thread 0x7fffe6734700 (LWP 4763)]
[New Thread 0x7fffe8f35700 (LWP 4764)]
[New Thread 0x7fffe9736700 (LWP 4765)]
[New Thread 0x7fffedf37700 (LWP 4766)]
[New Thread 0x7fff7f99a700 (LWP 4767)]
[New Thread 0x7fff7f199700 (LWP 4768)]
[New Thread 0x7fff7e998700 (LWP 4769)]
[New Thread 0x7fff7e017700 (LWP 4771)]
[New Thread 0x7fff7d816700 (LWP 4772)]
horse   cat plane truck
[New Thread 0x7fff7cdc7700 (LWP 4781)]
[New Thread 0x7fff76e8f700 (LWP 4782)]
[New Thread 0x7fff7668e700 (LWP 4783)]

Thread 1 "python3" received signal SIGSEGV, Segmentation fault.
0x00007fff77127bf0 in ?? () from /usr/lib/x86_64-linux-gnu/libcuda.so.1
(gdb) backtrace
#0  0x00007fff77127bf0 in ?? () from /usr/lib/x86_64-linux-gnu/libcuda.so.1
#1  0x00007fff77127c52 in ?? () from /usr/lib/x86_64-linux-gnu/libcuda.so.1
#2  0x00007fff7712851b in ?? () from /usr/lib/x86_64-linux-gnu/libcuda.so.1
#3  0x00007fff77062af9 in ?? () from /usr/lib/x86_64-linux-gnu/libcuda.so.1
#4  0x00007fff77087bc3 in ?? () from /usr/lib/x86_64-linux-gnu/libcuda.so.1
#5  0x00007fff76fc4d18 in ?? () from /usr/lib/x86_64-linux-gnu/libcuda.so.1
#6  0x00007fff76fc52ac in ?? () from /usr/lib/x86_64-linux-gnu/libcuda.so.1
#7  0x00007fffee089137 in ?? ()
   from /usr/local/lib/python3.6/dist-packages/torch/lib/libcudart-1b201d85.so.10.1
#8  0x00007fffee0815f0 in ?? ()
   from /usr/local/lib/python3.6/dist-packages/torch/lib/libcudart-1b201d85.so.10.1
#9  0x00007fffee08c012 in ?? ()
   from /usr/local/lib/python3.6/dist-packages/torch/lib/libcudart-1b201d85.so.10.1
#10 0x00007fffee091581 in ?? ()
   from /usr/local/lib/python3.6/dist-packages/torch/lib/libcudart-1b201d85.so.10.1
#11 0x00007fffee08382e in ?? ()
   from /usr/local/lib/python3.6/dist-packages/torch/lib/libcudart-1b201d85.so.10.1
#12 0x00007fffee0732c8 in ?? ()
---Type <return> to continue, or q <return> to quit---
   from /usr/local/lib/python3.6/dist-packages/torch/lib/libcudart-1b201d85.so.10.1
#13 0x00007fffee0a582c in cudaMalloc ()
   from /usr/local/lib/python3.6/dist-packages/torch/lib/libcudart-1b201d85.so.10.1
#14 0x00007ffff295469e in c10::cuda::CUDACachingAllocator::THCCachingAllocator::malloc(void**, unsigned long, CUstream_st*) ()
   from /usr/local/lib/python3.6/dist-packages/torch/lib/libc10_cuda.so
#15 0x00007ffff2955e6e in c10::cuda::CUDACachingAllocator::CudaCachingAllocator::allocate(unsigned long) const ()
   from /usr/local/lib/python3.6/dist-packages/torch/lib/libc10_cuda.so
#16 0x00007fff9b607789 in at::native::empty_cuda(c10::ArrayRef<long>, c10::TensorOptions const&, c10::optional<c10::MemoryFormat>) ()
   from /usr/local/lib/python3.6/dist-packages/torch/lib/libtorch.so
#17 0x00007fff9a04d728 in at::CUDAType::(anonymous namespace)::empty(c10::ArrayRef<long>, c10::TensorOptions const&, c10::optional<c10::MemoryFormat>) ()
   from /usr/local/lib/python3.6/dist-packages/torch/lib/libtorch.so
#18 0x00007fff99b06e18 in torch::autograd::VariableType::(anonymous namespace)::empty(c10::ArrayRef<long>, c10::TensorOptions const&, c10::optional<c10::MemoryFormat>) () from /usr/local/lib/python3.6/dist-packages/torch/lib/libtorch.so
#19 0x00007fff97a54971 in at::native::to_impl(at::Tensor const&, c10::TensorOptions const&, bool) ()
   from /usr/local/lib/python3.6/dist-packages/torch/lib/libtorch.so
---Type <return> to continue, or q <return> to quit---
#20 0x00007fff97a55312 in at::native::to(at::Tensor const&, c10::TensorOptions const&, bool, bool) ()
   from /usr/local/lib/python3.6/dist-packages/torch/lib/libtorch.so
#21 0x00007fff97d7e280 in at::TypeDefault::to(at::Tensor const&, c10::TensorOptions const&, bool, bool) ()
   from /usr/local/lib/python3.6/dist-packages/torch/lib/libtorch.so
#22 0x00007fff99918a63 in torch::autograd::VariableType::(anonymous namespace)::to(at::Tensor const&, c10::TensorOptions const&, bool, bool) ()
   from /usr/local/lib/python3.6/dist-packages/torch/lib/libtorch.so
#23 0x00007fffdd857087 in torch::autograd::dispatch_to(at::Tensor const&, c10::Device, bool, bool) ()
   from /usr/local/lib/python3.6/dist-packages/torch/lib/libtorch_python.so
#24 0x00007fffdd857e03 in torch::autograd::THPVariable_cuda(_object*, _object*, _object*) ()
   from /usr/local/lib/python3.6/dist-packages/torch/lib/libtorch_python.so
#25 0x000000000050abc5 in ?? ()
#26 0x000000000050c549 in _PyEval_EvalFrameDefault ()
#27 0x00000000005081d5 in ?? ()
#28 0x000000000050a020 in ?? ()
#29 0x000000000050aa1d in ?? ()
#30 0x000000000050c549 in _PyEval_EvalFrameDefault ()
#31 0x0000000000509ce8 in ?? ()
#32 0x000000000050aa1d in ?? ()
---Type <return> to continue, or q <return> to quit---
#33 0x000000000050c549 in _PyEval_EvalFrameDefault ()
#34 0x0000000000509ce8 in ?? ()
#35 0x000000000050aa1d in ?? ()
#36 0x000000000050c549 in _PyEval_EvalFrameDefault ()
#37 0x00000000005081d5 in ?? ()
#38 0x000000000050a020 in ?? ()
#39 0x000000000050aa1d in ?? ()
#40 0x000000000050c549 in _PyEval_EvalFrameDefault ()
#41 0x00000000005081d5 in ?? ()
#42 0x000000000050b3a3 in PyEval_EvalCode ()
#43 0x0000000000635082 in ?? ()
#44 0x0000000000635137 in PyRun_FileExFlags ()
#45 0x00000000006388ef in PyRun_SimpleFileExFlags ()
#46 0x0000000000639491 in Py_Main ()
#47 0x00000000004b0f60 in main ()
(gdb) disas
No function contains program counter for selected frame.