Libtorch C++ - 对于 InterpolateFuncOptions 调用 'size' 没有匹配的成员函数
Libtorch C++ - no matching member function for call to 'size' for InterpolateFuncOptions
在 C++ 中使用 Libtorch 1.6.0,出现以下错误:
error: no matching member function for call to 'size'
我的台词如下:
image = F::interpolate(image, F::InterpolateFuncOptions().size({target_height, target_width}).mode(torch::kNearest));
但在文档中它似乎是正确的...有什么想法吗?
提前致谢
你应该像这样用 std::vector
包裹它:
image = F::interpolate(image,
F::InterpolateFuncOptions()
.size(std::vector<>{target_height, target_width})
.mode(torch::kNearest));
原因是 size
没有对 std::initializer_list that you were trying to use (see size
docs here 的过载调用。
在 C++ 中使用 Libtorch 1.6.0,出现以下错误:
error: no matching member function for call to 'size'
我的台词如下:
image = F::interpolate(image, F::InterpolateFuncOptions().size({target_height, target_width}).mode(torch::kNearest));
但在文档中它似乎是正确的...有什么想法吗?
提前致谢
你应该像这样用 std::vector
包裹它:
image = F::interpolate(image,
F::InterpolateFuncOptions()
.size(std::vector<>{target_height, target_width})
.mode(torch::kNearest));
原因是 size
没有对 std::initializer_list that you were trying to use (see size
docs here 的过载调用。