编译[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...> {};
相关推荐
月小满21 小时前
DataV轮播时其他组件的内容也一起滚动 修复bug的方法
前端·vue.js·bug·大屏端
桃子丫1 天前
AD转 Cadence学习指南-BUG篇
bug
testtraveler1 天前
[Fix] ImportError: libtorch_cpu.so: undefined symbol: iJIT_NotifyEvent
pytorch·python·bug
测试者家园1 天前
从“找 bug”到“降风险”:测试思维模式的底层迁移
软件测试·bug·风险管理·持续测试·测试基础·智能化测试·测试思维模式
chde2Wang2 天前
运行scala文件报错xsbt.CompilerInterface
bug·scala
艾小码2 天前
为什么你的Vue组件总出bug?可能是少了这份测试指南
前端·vue.js·debug
离离茶3 天前
【笔记1-8】Qt bug记录:QListWidget窗口的浏览模式切换为ListMode后,滚轮滚动速度变慢
笔记·qt·bug
程序猿阿伟3 天前
《从被动修复到免疫:游戏Bug闭环体系的深度搭建指南》
游戏·bug
eason_fan3 天前
解决 Monorepo 项目中 node-sass 安装失败的 Python 版本兼容性问题
前端·debug
Cola可洛6 天前
修复Flyme移植BUG
android·bug