编译[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...> {};
相关推荐
Lei活在当下4 小时前
【项目踩坑实录】并发环境下,Glide缓存引起的图片加载异常
android·debug·glide
测试199814 小时前
一个只能通过压测发现Bug
自动化测试·软件测试·python·selenium·测试工具·bug·压力测试
狂奔的sherry19 小时前
网卡获取模组ip失败问题解析
bug
nnsix1 天前
Unity ReferenceFinder插件 多选资源查找bug解决
unity·游戏引擎·bug
中冕—霍格沃兹软件开发测试2 天前
边界值分析:功能测试中的精度利器
人工智能·功能测试·科技·测试工具·appium·bug
中冕—霍格沃兹软件开发测试2 天前
探索性测试:思维驱动下的高效缺陷狩猎
人工智能·科技·开源·appium·bug
中冕—霍格沃兹软件开发测试2 天前
Git版本控制在测试项目管理中的应用
人工智能·git·科技·开源·appium·bug
中冕—霍格沃兹软件开发测试3 天前
用户体验测试:功能与界面并重
人工智能·科技·开源·appium·bug·ux
中冕—霍格沃兹软件开发测试4 天前
测试工具链的构建与团队协作:从工具集成到价值流动
人工智能·科技·测试工具·开源·appium·bug
Aspect of twilight4 天前
vscode python debug方式
ide·vscode·python·debug