I installed cuda 9.1 and the last nvidia driver 390.25
±----------------------------------------------------------------------------+
| NVIDIA-SMI 390.25                 Driver Version: 390.25                    |
|-------------------------------±---------------------±---------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 950M    Off  | 00000000:01:00.0 Off |                  N/A |
| N/A   47C    P0    N/A /  N/A |    455MiB /  4046MiB |      3%      Default |
±------------------------------±---------------------±---------------------+
±----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0      1149      G   /usr/lib/xorg/Xorg                           192MiB |
|    0      1906      G   compiz                                       182MiB |
|    0      2391      G   …-token=88128EE1E6E9ED25FEB54AFDB2472B7F    76MiB |
|    0      3837      G   /usr/bin/nvidia-settings                       0MiB |
±----------------------------------------------------------------------------+
but I have an error: Found GPU0 GeForce GTX 950M which is of cuda capability 5.0.
PyTorch no longer supports this GPU because it is too old.