Caffe2 Error: more than one operator “+” matches these operands, windows and Cuda 11

🐛 Bug

An error occurs while building PyTorch from the latest master on Win10 with VS2019 and Cuda 11. The error seems to be from Caffe2 (refer to the error quote below). Thanks in advance.

To Reproduce

Steps to reproduce the behavior:

On Windows 10 Home:

  1. Download and install the latest NVIDIA drivers and Visual Studio 2019 (with Visual C++).
  2. Download and install the latest Cuda Toolkit (Cuda 11).
  3. Download and install python 3.8
  4. Clone the master branch of PyTorch.
  5. Download and install the PyTorch dependencies.
  6. In CMD: run “set CMAKE_GENERATOR=Visual Studio 16 2019”
  7. In the PyTorch repo directory: run “python setup.py install”

The error:

[1040/1919] Building NVCC (Device) object caffe2/CMakeFiles/torch_cuda.dir/__/aten/src/ATen/native/cuda/torch_cuda_generated_DilatedMaxPool2d.cu.obj
FAILED: caffe2/CMakeFiles/torch_cuda.dir/operators/torch_cuda_generated_utility_ops.cu.obj
…[cmd command info here]…
C:/…/pytorch/build\caffe2/proto/caffe2.pb.h(151): error: more than one operator “+” matches these operands:
built-in operator “arithmetic + arithmetic”
function “c10::operator+(int, c10::BFloat16)”
function “c10::operator+(c10::BFloat16, int)”
function “c10::operator+(int, c10::Half)”
function “c10::operator+(c10::Half, int)”
operand types are: const caffe2::ExternalDataProto_SourceType + int

Expected behavior

The build should complete successfully. I haven’t made any modifications to the clone.

Environment

PyTorch version: N/A
Is debug build: N/A
CUDA used to build PyTorch: N/A

OS: Microsoft Windows 10 Home (ver 19041)
GCC version: Could not collect
CMake version: version 3.18.0

Python version: 3.8
Is CUDA available: Yes
CUDA runtime version: Cuda 11
GPU models and configuration: GPU 0: GeForce GT 710 (compute capability: 3.5)
Nvidia driver version: 451.67
cuDNN version: Could not collect

Versions of relevant libraries:
[pip3] numpy==1.18.4
[conda] Could not collect

cc @malfet @peterjc123 @maxluk @nbcsm @guyang3532 @gunandrose4u @smartcat2010 @mszhanyi

1 possible answer(s) on “Caffe2 Error: more than one operator “+” matches these operands, windows and Cuda 11