I try to call the tensor’s in place mean function given an array of dimensions in libtorch (Pytorch C++ lib):
inline at::Tensor mean(const at::Tensor & self, at::OptionalIntArrayRef dim, bool keepdim=false, c10::optional<at::ScalarType> dtype=c10::nullopt)
Just curious that how to construct the at::OptionalIntArrayRef
type argument given a vector<int64_t>?
For example, I have a 3-dimension tensor x. I want to call x.mean({1, 2})
, but instead of using initialized_list, I hope the {1, 2} can come from a vector<int64_t> input. How to write such a statement?