Hi!
My code raises the error
src/local_relation_cuda.cpp:290:147: error: call of overloaded ‘sum(<brace-enclosed initializer list>)’ is ambiguous
pos_weight_grad = pos_weight_grad + sim_grad_buffer.view({cur_batch_step, num_group, kernel_height, kernel_width, height * width}).sum({0, 4});
^
In file included from /data/home/v-jining/anaconda3/lib/python3.7/site-packages/torch/include/ATen/Tensor.h:12:0,
from /data/home/v-jining/anaconda3/lib/python3.7/site-packages/torch/include/ATen/Context.h:4,
from /data/home/v-jining/anaconda3/lib/python3.7/site-packages/torch/include/ATen/ATen.h:5,
from /data/home/v-jining/anaconda3/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/types.h:3,
from /data/home/v-jining/anaconda3/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
from /data/home/v-jining/anaconda3/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
from /data/home/v-jining/anaconda3/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
from /data/home/v-jining/anaconda3/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader.h:3,
from /data/home/v-jining/anaconda3/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/data.h:3,
from /data/home/v-jining/anaconda3/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/all.h:4,
from /data/home/v-jining/anaconda3/lib/python3.7/site-packages/torch/include/torch/extension.h:4,
from src/local_relation_cuda.cpp:2:
/data/home/v-jining/anaconda3/lib/python3.7/site-packages/torch/include/ATen/core/TensorMethods.h:2692:15: note: candidate: at::Tensor at::Tensor::sum(c10::IntArrayRef, bool, c10::optional<c10::ScalarType>) const
inline Tensor Tensor::sum(IntArrayRef dim, bool keepdim, c10::optional<ScalarType> dtype) const {
^
/data/home/v-jining/anaconda3/lib/python3.7/site-packages/torch/include/ATen/core/TensorMethods.h:2703:15: note: candidate: at::Tensor at::Tensor::sum(at::DimnameList, bool, c10::optional<c10::ScalarType>) const
inline Tensor Tensor::sum(DimnameList dim, bool keepdim, c10::optional<ScalarType> dtype) const {
^
error: command 'gcc' failed with exit status 1
And I find two at::sum definitions:
static Tensor at::sum(const Tensor &self, IntArrayRef dim, bool keepdim = false, c10::optional<ScalarType> dtype = c10::nullopt)
static Tensor at::sum(const Tensor &self, DimnameList dim, bool keepdim = false, c10::optional<ScalarType> dtype = c10::nullopt)
I want to know the difference between the two overloaded functions. And what is the difference between IntArrayRef and DimnameList? How to prevent the issue “call of overloaded ‘sum()’ is ambiguous”?
Thank you!