编译[Bug]——too few arguments for template template parameter “Tuple“ detected

项目场景:

当使用高版本的cuda去安装低版本pytorch,并且编译用低版本pytorch写的cuda算子时,或者说是VS的版本过高如2022和2019,都有可能会出现某个.h文件或者.c文件报错,如:

复制代码
error: too few arguments for template template parameter "Tuple" detected during instantiation of class "pybind11::detail::tuple_caster<Tuple, Ts...>

解决方案:

修改报错对应行的表达式,像我这里报错的是torch里的cast.h的文件,网络上关于这个cast.h的错误好像就是最多的,就去conda envs里的

复制代码
torch/include/pybind11/cast.h

在报错的前面加上下面的代码进行修改,提前定义这个tuple_caster

复制代码
template <template <typename...> class Tuple, typename... Ts>
class tuple_caster;

template <typename T1, typename T2> class type_caster<std::pair<T1, T2>>
    : public tuple_caster<std::pair, T1, T2> {};

template <typename... Ts> class type_caster<std::tuple<Ts...>>
    : public tuple_caster<std::tuple, Ts...> {};
相关推荐
MrBread7 天前
微任务链式派生阻塞渲染
前端·debug
ALGO阿狗8 天前
SimpleDateFormat(“YYYY-MM-dd“)格式化时间出现了bug?
bug
冬奇Lab9 天前
应用异常退出实战分析:一次"幽灵杀手"引发的车载系统故障排查
android·性能优化·debug
yuki_uix9 天前
为什么我的 Auth Token 藏在了 Network 面板的 Doc 里?
前端·python·debug
爱学习的小可爱卢9 天前
JavaSE基础-Java异常体系:Bug定位终极指南
java·bug·javase
GeekyGuru9 天前
代码诊疗室——疑难Bug破解战
bug
嵌入式×边缘AI:打怪升级日志12 天前
9.2.3 UART 驱动严重 Bug(保姆级讲解)
bug
qq_242188633214 天前
代码诊疗室——疑难Bug破解战
bug
Moshow郑锴16 天前
Java SpringBoot 疑难 Bug 排查思路解析:从“语法正确”到“行为相符”
java·spring boot·bug
人间花海16 天前
BUG终结者:挑战你的调试极限
bug