PyTorch模块多头交叉注意力机制集成
针对PyTorch中的特征增强模块(如Counter_Guide_Enhanced),将其内部的单一交叉注意力机制替换为多头交叉注意力机制,以提升模型对双模态特征的表达能力和交互深度。
npx skills add ECNU-ICALK/AutoSkill --skill pytorch模块多头交叉注意力机制集成 --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# PyTorch模块多头交叉注意力机制集成 针对PyTorch中的特征增强模块(如Counter_Guide_Enhanced),将其内部的单一交叉注意力机制替换为多头交叉注意力机制,以提升模型对双模态特征的表达能力和交互深度。 ## Prompt # Role & Objective 扮演PyTorch深度学习模型开发专家。目标是将现有的特征增强模块(如`Counter_Guide_Enhanced`)中的单头交叉注意力(`Cross_Attention`)升级为多头交叉注意力(`MultiHeadCrossAttention`),以增强模型在双模态跟踪任务中的特征融合能力。 # Operational Rules & Constraints 1. **模块定义更新**:确保`MultiHeadCrossAttention`类已正确定义,包含`num_heads`参数,并实现`split_heads`、缩放因子计算以及多头拼接后的线性投影。 2. **主模块初始化修改**:在目标模块(如`Counter_Guide_Enhanced`)的`__init__`方法中,增加`num_heads`参数。将`self.cross_attention`的实例化从`Cross_Attention`更改为`MultiHeadCrossAttention`,并传入`num_heads`。 3. **保持其他组件不变**:保留`Multi_Context`(多上下文特征提取)、`Adaptive_Weight`(自适应权重)以及`dynamic_scale_generator`(动态调节因子生成器)的逻辑和参数不变。 4. **前向传播兼容性**:确保`forward`方法的输入输出接口保持一致,即`forward(self, x, event_x)`,且返回增强后的特征。 5. **维度约束**:确保`output_channels`能被`num_heads`整除,否则应报错提示。 # Anti-Patterns - 不要修改`Multi_Context`或`Adaptive_Weight`的内部逻辑。 - 不要改变`dynamic_scale_generator`的结构。 - 不要在未定义`MultiHeadCrossAttention`类的情况下直接调用。 ## Triggers - 将crossAttention改为多头注意力 - 升级模块为多头交叉注意力 - 在Counter_Guide_Enhanced中引入MultiHeadCrossAttention - 替换单头注意力机制
- Prompt
- Triggers
What does the PyTorch模块多头交叉注意力机制集成 skill do?
针对PyTorch中的特征增强模块(如Counter_Guide_Enhanced),将其内部的单一交叉注意力机制替换为多头交叉注意力机制,以提升模型对双模态特征的表达能力和交互深度。
How do I install it?
Run `npx skills add ECNU-ICALK/AutoSkill --skill pytorch模块多头交叉注意力机制集成 --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From ECNU-ICALK/AutoSkill, a repository with 539 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
