编译[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...> {};
相关推荐
TTGGGFF7 小时前
报错解决:IEEE latex模版中thanks不显示 隶属关系 / 邮箱不显示
bug
李趣趣14 小时前
数据库字段类型bit容易被忽视的bug
c#·bug
kitsch0x971 天前
论文学习_One Bug, Hundreds Behind: LLMs for Large-Scale Bug Discovery
学习·bug
Brianna Home4 天前
从零到一:用Godot打造2D游戏《丛林探险》
算法·游戏·性能优化·游戏引擎·bug·godot·动画
boss-dog4 天前
崩溃信息追溯——backward-cpp
c++·debug·backward-cpp
AI云原生4 天前
云原生系列Bug修复:Docker镜像无法启动的终极解决方案与排查思路
运维·服务器·python·docker·云原生·容器·bug
东巴图5 天前
分解如何利用c++修复小程序的BUG
开发语言·c++·bug
workflower8 天前
Fundamentals of Architectural Styles and patterns
开发语言·算法·django·bug·结对编程
lvchaoq8 天前
记录小程序真机bug,而模拟器无法复现
小程序·bug