Hi. I am trying to build libtorch ver 1.7.0 on windows (Windows10, MSVC2019,2017, CUDA10.1)
I got the following error below
C:\PROGRA~2\MICROS~4\2019\PROFES~1\VC\Tools\MSVC\1428~1.293\bin\Hostx64\x64\cl.exe   /TP -DAT_CORE_STATIC_WINDOWS=1 -DCPUINFO_SUPPORTED_PLATFORM=1 -DFMT_HEADER_ONLY=1 -DMINIZ_DISABLE_ZIP_READER_CRC32_CHECKS -DONNXIFI_ENABLE_EXT=1 -DONNX_ML=1 -DONNX_NAMESPACE=onnx_c2 -DUSE_EXTERNAL_MZCRC -DWIN32_LEAN_AND_MEAN -D_CRT_SECURE_NO_DEPRECATE=1 -Iaten\src -I..\aten\src -I. -I..\ -I..\third_party\onnx -Ithird_party\onnx -I..\third_party\foxi -Ithird_party\foxi -I..\torch\csrc\api -I..\torch\csrc\api\include -I..\caffe2\aten\src\TH -Icaffe2\aten\src\TH -Icaffe2\aten\src -Icaffe2\..\aten\src -Icaffe2\..\aten\src\ATen -I..\torch\csrc -I..\third_party\miniz-2.0.8 -I..\aten\src\TH -I..\aten\..\third_party\catch\single_include -I..\aten\src\ATen\.. -Icaffe2\aten\src\ATen -I..\caffe2\core\nomnigraph\include -I..\c10\.. -I..\third_party\cpuinfo\include -I..\third_party\FP16\include -I..\third_party\fmt\include -Ithird_party\ideep\mkl-dnn\include -I..\third_party\ideep\mkl-dnn\src\..\include -I..\third_party\protobuf\src -I..\cmake\..\third_party\eigen -I..\cmake\..\third_party\pybind11\include -I..\cmake\..\third_party\cub -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include" -I..\third_party\ideep\mkl-dnn\include -I..\third_party\ideep\include -I..\caffe2 /DWIN32 /D_WINDOWS /GR /EHsc /w /bigobj -openmp:experimental -DNDEBUG -DUSE_VULKAN_WRAPPER -DHAVE_AVX_CPU_DEFINITION -DHAVE_AVX2_CPU_DEFINITION /MT /O2 /Ob2 /DNDEBUG /w /bigobj -DNDEBUG   -DCUDA_HAS_FP16=1 -DUSE_GCC_GET_CPUID -DUSE_AVX -DUSE_AVX2 -DTH_HAVE_THREAD /EHsc /DNOMINMAX /wd4267 /wd4251 /wd4522 /wd4838 /wd4305 /wd4244 /wd4190 /wd4101 /wd4996 /wd4275 /bigobj -O2 -openmp:experimental -DCAFFE2_BUILD_MAIN_LIB -std:c++14 /fp:strict  /DCPU_CAPABILITY=DEFAULT /DCPU_CAPABILITY_DEFAULT /showIncludes /Focaffe2\CMakeFiles\torch_cpu.dir\__\aten\src\ATen\native\cpu\SortingKernel.cpp.DEFAULT.cpp.obj /Fdcaffe2\CMakeFiles\torch_cpu.dir\torch_cpu.pdb /FS -c aten\src\ATen\native\cpu\SortingKernel.cpp.DEFAULT.cpp
FAILED: caffe2/CMakeFiles/torch_cpu.dir/__/aten/src/ATen/native/cpu/SortingKernel.cpp.DEFAULT.cpp.obj
C:\PROGRA~2\MICROS~4\2019\PROFES~1\VC\Tools\MSVC\1428~1.293\bin\Hostx64\x64\cl.exe   /TP -DAT_CORE_STATIC_WINDOWS=1 -DCPUINFO_SUPPORTED_PLATFORM=1 -DFMT_HEADER_ONLY=1 -DMINIZ_DISABLE_ZIP_READER_CRC32_CHECKS -DONNXIFI_ENABLE_EXT=1 -DONNX_ML=1 -DONNX_NAMESPACE=onnx_torch -DUSE_EXTERNAL_MZCRC -DWIN32_LEAN_AND_MEAN -D_CRT_SECURE_NO_DEPRECATE=1 -Iaten\src -I..\aten\src -I. -I..\ -I..\third_party\onnx -Ithird_party\onnx -I..\third_party\foxi -Ithird_party\foxi -I..\torch\csrc\api -I..\torch\csrc\api\include -I..\caffe2\aten\src\TH -Icaffe2\aten\src\TH -Icaffe2\aten\src -Icaffe2\..\aten\src -Icaffe2\..\aten\src\ATen -I..\torch\csrc -I..\third_party\miniz-2.0.8 -I..\aten\src\TH -I..\aten\..\third_party\catch\single_include -I..\aten\src\ATen\.. -Icaffe2\aten\src\ATen -I..\caffe2\core\nomnigraph\include -I..\c10\.. -I..\third_party\cpuinfo\include -I..\third_party\FP16\include -I..\third_party\fmt\include -Ithird_party\ideep\mkl-dnn\include -I..\third_party\ideep\mkl-dnn\src\..\include -I..\third_party\protobuf\src -I..\cmake\..\third_party\eigen -I..\cmake\..\third_party\pybind11\include -I..\cmake\..\third_party\cub -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include" -I..\third_party\ideep\mkl-dnn\include -I..\third_party\ideep\include -I..\caffe2 /DWIN32 /D_WINDOWS /GR /EHsc /w /bigobj -openmp:experimental -DNDEBUG -DUSE_VULKAN_WRAPPER -DHAVE_AVX_CPU_DEFINITION -DHAVE_AVX2_CPU_DEFINITION /MT /O2 /Ob2 /DNDEBUG /w /bigobj -DNDEBUG   -DCUDA_HAS_FP16=1 -DUSE_GCC_GET_CPUID -DUSE_AVX -DUSE_AVX2 -DTH_HAVE_THREAD /EHsc /DNOMINMAX /wd4267 /wd4251 /wd4522 /wd4838 /wd4305 /wd4244 /wd4190 /wd4101 /wd4996 /wd4275 /bigobj -O2 -openmp:experimental -DCAFFE2_BUILD_MAIN_LIB -std:c++14 /fp:strict  /DCPU_CAPABILITY=DEFAULT /DCPU_CAPABILITY_DEFAULT /showIncludes /Focaffe2\CMakeFiles\torch_cpu.dir\__\aten\src\ATen\native\cpu\SortingKernel.cpp.DEFAULT.cpp.obj /Fdcaffe2\CMakeFiles\torch_cpu.dir\torch_cpu.pdb /FS -c aten\src\ATen\native\cpu\SortingKernel.cpp.DEFAULT.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 19.28.29334 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29333\include\algorithm(7417): error C2678: binary '*': no operator found which takes a left-hand operand of type 'const _BidIt' (or there is no acceptable conversion)
        with
        [
            _BidIt=at::native::CompositeRandomAccessor<at::native::StridedRandomAccessor<scalar_t,int64_t,at::native::DefaultPtrTraits>,at::native::StridedRandomAccessor<int64_t,int64_t,at::native::DefaultPtrTraits>,at::native::TupleInfoCPU>
        ]
..\aten\src\ATen/native/CompositeRandomAccessorCommon.h(132): note: could be 'at::native::references_holder<std::tuple<unsigned char,__int64>,std::tuple<unsigned char &,__int64 &>> at::native::CompositeRandomAccessor<at::native::StridedRandomAccessor<scalar_t,int64_t,at::native::DefaultPtrTraits>,at::native::StridedRandomAccessor<int64_t,int64_t,at::native::DefaultPtrTraits>,at::native::TupleInfoCPU>::operator *(void)'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29333\include\algorithm(7417): note: while trying to match the argument list '(const _BidIt)'
        with
        [
            _BidIt=at::native::CompositeRandomAccessor<at::native::StridedRandomAccessor<scalar_t,int64_t,at::native::DefaultPtrTraits>,at::native::StridedRandomAccessor<int64_t,int64_t,at::native::DefaultPtrTraits>,at::native::TupleInfoCPU>
        ]
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29333\include\algorithm(7541): note: see reference to function template instantiation '_BidIt std::_Insertion_sort_unchecked<_RanIt,_Pr>(const _BidIt,const _BidIt,_Pr)' being compiled
        with
        [
            _BidIt=at::native::CompositeRandomAccessor<at::native::StridedRandomAccessor<scalar_t,int64_t,at::native::DefaultPtrTraits>,at::native::StridedRandomAccessor<int64_t,int64_t,at::native::DefaultPtrTraits>,at::native::TupleInfoCPU>,
            _RanIt=at::native::CompositeRandomAccessor<at::native::StridedRandomAccessor<scalar_t,int64_t,at::native::DefaultPtrTraits>,at::native::StridedRandomAccessor<int64_t,int64_t,at::native::DefaultPtrTraits>,at::native::TupleInfoCPU>,
            _Pr=at::native::`anonymous-namespace'::KeyValueCompDesc<scalar_t>
        ]
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29333\include\algorithm(7571): note: see reference to function template instantiation 'void std::_Sort_unchecked<_RanIt,_Fn>(_RanIt,_RanIt,__int64,_Pr)' being compiled
        with
        [
            _RanIt=at::native::CompositeRandomAccessor<at::native::StridedRandomAccessor<scalar_t,int64_t,at::native::DefaultPtrTraits>,at::native::StridedRandomAccessor<int64_t,int64_t,at::native::DefaultPtrTraits>,at::native::TupleInfoCPU>,
            _Fn=at::native::`anonymous-namespace'::KeyValueCompDesc<scalar_t>,
            _Pr=at::native::`anonymous-namespace'::KeyValueCompDesc<scalar_t>
        ]
aten\src\ATen\native\cpu\SortingKernel.cpp.DEFAULT.cpp(120): note: see reference to function template instantiation 'void std::sort<at::native::CompositeRandomAccessor<at::native::StridedRandomAccessor<scalar_t,int64_t,at::native::DefaultPtrTraits>,at::native::StridedRandomAccessor<int64_t,int64_t,at::native::DefaultPtrTraits>,at::native::TupleInfoCPU>,at::native::`anonymous-namespace'::KeyValueCompDesc<scalar_t>>(const _RanIt,const _RanIt,_Pr)' being compiled
        with
        [
            _RanIt=at::native::CompositeRandomAccessor<at::native::StridedRandomAccessor<scalar_t,int64_t,at::native::DefaultPtrTraits>,at::native::StridedRandomAccessor<int64_t,int64_t,at::native::DefaultPtrTraits>,at::native::TupleInfoCPU>,
            _Pr=at::native::`anonymous-namespace'::KeyValueCompDesc<scalar_t>
        ]
aten\src\ATen\native\cpu\SortingKernel.cpp.DEFAULT.cpp(51): note: see reference to function template instantiation 'void at::native::`anonymous-namespace'::sort_kernel::<lambda_fc9d6cf05948cd4738c93522917cfd75>::operator ()<scalar_t,int64_t>(scalar_t *,int64_t,int64_t *,int64_t,int64_t) const' being compiled
aten\src\ATen\native\cpu\SortingKernel.cpp.DEFAULT.cpp(127): note: see reference to function template instantiation 'void at::native::`anonymous-namespace'::_dim_apply<at::native::`anonymous-namespace'::sort_kernel::<lambda_fc9d6cf05948cd4738c93522917cfd75>>(at::Tensor &,at::Tensor &,int64_t,const std::string &,const func_t &)' being compiled
        with
        [
            func_t=at::native::`anonymous-namespace'::sort_kernel::<lambda_fc9d6cf05948cd4738c93522917cfd75>
        ]
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29333\include\algorithm(7417): error C2100: illegal indirection
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29333\include\algorithm(7419): error C2678: binary '*': no operator found which takes a left-hand operand of type 'const _BidIt' (or there is no acceptable conversion)
        with
        [
            _BidIt=at::native::CompositeRandomAccessor<at::native::StridedRandomAccessor<scalar_t,int64_t,at::native::DefaultPtrTraits>,at::native::StridedRandomAccessor<int64_t,int64_t,at::native::DefaultPtrTraits>,at::native::TupleInfoCPU>
        ]
..\aten\src\ATen/native/CompositeRandomAccessorCommon.h(132): note: could be 'at::native::references_holder<std::tuple<unsigned char,__int64>,std::tuple<unsigned char &,__int64 &>> at::native::CompositeRandomAccessor<at::native::StridedRandomAccessor<scalar_t,int64_t,at::native::DefaultPtrTraits>,at::native::StridedRandomAccessor<int64_t,int64_t,at::native::DefaultPtrTraits>,at::native::TupleInfoCPU>::operator *(void)'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29333\include\algorithm(7419): note: while trying to match the argument list '(const _BidIt)'
        with
        [
            _BidIt=at::native::CompositeRandomAccessor<at::native::StridedRandomAccessor<scalar_t,int64_t,at::native::DefaultPtrTraits>,at::native::StridedRandomAccessor<int64_t,int64_t,at::native::DefaultPtrTraits>,at::native::TupleInfoCPU>
        ]
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29333\include\algorithm(7419): error C2100: illegal indirection
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29333\include\algorithm(7417): error C2678: binary '*': no operator found which takes a left-hand operand of type 'const _BidIt' (or there is no acceptable conversion)
        with
        [
            _BidIt=at::native::CompositeRandomAccessor<at::native::StridedRandomAccessor<int64_t,int64_t,at::native::DefaultPtrTraits>,at::native::StridedRandomAccessor<int64_t,int64_t,at::native::DefaultPtrTraits>,at::native::TupleInfoCPU>
        ]
..\aten\src\ATen/native/CompositeRandomAccessorCommon.h(132): note: could be 'at::native::references_holder<std::tuple<__int64,__int64>,std::tuple<__int64 &,__int64 &>> at::native::CompositeRandomAccessor<at::native::StridedRandomAccessor<int64_t,int64_t,at::native::DefaultPtrTraits>,at::native::StridedRandomAccessor<int64_t,int64_t,at::native::DefaultPtrTraits>,at::native::TupleInfoCPU>::operator *(void)'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29333\include\algorithm(7417): note: while trying to match the argument list '(const _BidIt)'
        with
        [
            _BidIt=at::native::CompositeRandomAccessor<at::native::StridedRandomAccessor<int64_t,int64_t,at::native::DefaultPtrTraits>,at::native::StridedRandomAccessor<int64_t,int64_t,at::native::DefaultPtrTraits>,at::native::TupleInfoCPU>
        ]
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29333\include\algorithm(7541): note: see reference to function template instantiation '_BidIt std::_Insertion_sort_unchecked<_RanIt,_Pr>(const _BidIt,const _BidIt,_Pr)' being compiled
        with
        [
            _BidIt=at::native::CompositeRandomAccessor<at::native::StridedRandomAccessor<int64_t,int64_t,at::native::DefaultPtrTraits>,at::native::StridedRandomAccessor<int64_t,int64_t,at::native::DefaultPtrTraits>,at::native::TupleInfoCPU>,
            _RanIt=at::native::CompositeRandomAccessor<at::native::StridedRandomAccessor<int64_t,int64_t,at::native::DefaultPtrTraits>,at::native::StridedRandomAccessor<int64_t,int64_t,at::native::DefaultPtrTraits>,at::native::TupleInfoCPU>,
            _Pr=at::native::`anonymous-namespace'::KeyValueCompDesc<scalar_t>
        ]
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29333\include\algorithm(7571): note: see reference to function template instantiation 'void std::_Sort_unchecked<_RanIt,_Fn>(_RanIt,_RanIt,__int64,_Pr)' being compiled
        with
        [
            _RanIt=at::native::CompositeRandomAccessor<at::native::StridedRandomAccessor<int64_t,int64_t,at::native::DefaultPtrTraits>,at::native::StridedRandomAccessor<int64_t,int64_t,at::native::DefaultPtrTraits>,at::native::TupleInfoCPU>,
            _Fn=at::native::`anonymous-namespace'::KeyValueCompDesc<scalar_t>,
            _Pr=at::native::`anonymous-namespace'::KeyValueCompDesc<scalar_t>
        ]
aten\src\ATen\native\cpu\SortingKernel.cpp.DEFAULT.cpp(120): note: see reference to function template instantiation 'void std::sort<at::native::CompositeRandomAccessor<at::native::StridedRandomAccessor<int64_t,int64_t,at::native::DefaultPtrTraits>,at::native::StridedRandomAccessor<int64_t,int64_t,at::native::DefaultPtrTraits>,at::native::TupleInfoCPU>,at::native::`anonymous-namespace'::KeyValueCompDesc<scalar_t>>(const _RanIt,const _RanIt,_Pr)' being compiled
        with
        [
            _RanIt=at::native::CompositeRandomAccessor<at::native::StridedRandomAccessor<int64_t,int64_t,at::native::DefaultPtrTraits>,at::native::StridedRandomAccessor<int64_t,int64_t,at::native::DefaultPtrTraits>,at::native::TupleInfoCPU>,
            _Pr=at::native::`anonymous-namespace'::KeyValueCompDesc<scalar_t>
        ]
aten\src\ATen\native\cpu\SortingKernel.cpp.DEFAULT.cpp(51): note: see reference to function template instantiation 'void at::native::`anonymous-namespace'::sort_kernel::<lambda_fc9d6cf05948cd4738c93522917cfd75>::operator ()<scalar_t,int64_t>(scalar_t *,int64_t,int64_t *,int64_t,int64_t) const' being compiled
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29333\include\algorithm(7419): error C2678: binary '*': no operator found which takes a left-hand operand of type 'const _BidIt' (or there is no acceptable conversion)
        with
        [
            _BidIt=at::native::CompositeRandomAccessor<at::native::StridedRandomAccessor<int64_t,int64_t,at::native::DefaultPtrTraits>,at::native::StridedRandomAccessor<int64_t,int64_t,at::native::DefaultPtrTraits>,at::native::TupleInfoCPU>
        ]
..\aten\src\ATen/native/CompositeRandomAccessorCommon.h(132): note: could be 'at::native::references_holder<std::tuple<__int64,__int64>,std::tuple<__int64 &,__int64 &>> at::native::CompositeRandomAccessor<at::native::StridedRandomAccessor<int64_t,int64_t,at::native::DefaultPtrTraits>,at::native::StridedRandomAccessor<int64_t,int64_t,at::native::DefaultPtrTraits>,at::native::TupleInfoCPU>::operator *(void)'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29333\include\algorithm(7419): note: while trying to match the argument list '(const _BidIt)'
        with
        [
            _BidIt=at::native::CompositeRandomAccessor<at::native::StridedRandomAccessor<int64_t,int64_t,at::native::DefaultPtrTraits>,at::native::StridedRandomAccessor<int64_t,int64_t,at::native::DefaultPtrTraits>,at::native::TupleInfoCPU>
        ]

My creation process is following.
set USE_CUDA=ON
script\build_windows.bat

Do you have any suggestion ?
Thanks.