编译[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...> {};
相关推荐
奶茶精Gaaa16 小时前
测试能力提升--Bug分析能力
bug
LJianK11 天前
idea自带的数据库修改默认值有bug
bug
这个软件需要设计一下4 天前
ninedata安装磁盘不足问题解决
运维·bug
热爱生活的五柒4 天前
cc-switch安装方法、介绍及遇到的bug
bug·cc-switch
Greenland_124 天前
Android 混淆与混淆后bug日志问题定位
android·bug
应用市场4 天前
踩坑记录:有符号整数位运算的那些隐蔽Bug——符号扩展、算术右移与补码
java·开发语言·bug
一灰灰blog5 天前
Jar包会自己消失?Excel会“记忆“数据?我遇到了两个灵异bug
java·spring boot·bug·excel
王家视频教程图书馆6 天前
修复服务端500相应,修复客户端上传文件.tmp 服务端接受不到文件bug
bug
qq_401700416 天前
Qt开发过程中遇到哪些经典的bug
qt·bug
0白露8 天前
关闭搜狗输入法右下角广告,可以适用于大多数应用系统通知的广告
windows·bug