Build errors when compiling PyTorch on Windows 10 with CUDA support

I have been trying to compile PyTorch from source on Windows 10. I am following the steps as suggested on GitHub - pytorch/pytorch: Tensors and Dynamic neural networks in Python with strong GPU acceleration.

I have followed these steps to compile it with Ninja after having problems trying to compile it with the default steps mentioned.

These are the steps I have followed after cloning pytorch.

1.set CMAKE_GENERATOR=Ninja
2.set USE_NINJA=ON

3.set CMAKE_GENERATOR_TOOLSET_VERSION=14.11
4.set DISTUTILS_USE_SDK=1

5.for /f “usebackq tokens=*” %i in ("%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -version [15^,16^) -products * -latest -property installationPath) do call “D:\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat” x64 -vcvars_ver=%CMAKE_GENERATOR_TOOLSET_VERSION%

6.set CUDAHOSTCXX=D:\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\bin\HostX64\x64\cl.exe

7.python setup.py install

and after taking hours to compile I received this traceback from the anaconda console.

I have uploaded the Image from the traceback and I would really get some help on how to solve this as I am trying to go through the fastai course using my own gpu but it says that old gpus are not supported. I have a GTX 960M GPU and was asked to compile it from source to make it work.

Thanks.

So I tried fixing the problem and found out that I had not downloaded and install cudnn.
I installed it and reran python setup.py install and it worked.