at::Tensor at::Tensor::index(const c10::List<c10::optional<at::Tensor>> &) const": Cannot convert parameter 1 from "at::Tensor" to "c10: :ArrayRef<at::indexing::TensorIndex>

When I upgraded the libtorch version to 1.9,
error

at::Tensor at::Tensor::index(const c10::List<c10::optional<at::Tensor>> &) const": Cannot convert parameter 1 from "at::Tensor" to "c10: :ArrayRef<at::indexing::TensorIndex>

occurred when compiling code.

conf_noobj = pred_conf.index(noobj_mask).mean();

Please help me what is the reason for this?

I have solved this problem used index({})
conf_noobj = pred_conf.index({noobj_mask}).mean();

1 Like