I have recently installed PyTorch from source with cuda 9.0. The only thing I needed to do is to remove magma, which was compiled for cuda 8.0. For reference, my environment is Ubuntu 16.04, cuda 9.0, cudNN 7.