Graphical einops: 桥接张量网络与计算图
Graphical einops: bridging tensor networks and computation graphs
AI总结:
本文提出一种形式化的图形演算,用于einops的张量编程结构片段,通过等级自然性重写实现张量等变性的图解证明,并应用于注意力掩码转换以优化稀疏注意力实现。
摘要:
架构图在深度学习中无处不在,但它们通常仅具有表示性:它们所暗示的张量程序恒等式仍然通过散文和张量轴操作来证明。我们为einops基础下的张量编程结构片段引入了一种形式化的图形演算,使得此类图能够支持证明。我们的演算将张量轴表示为围绕基础类型的嵌套分级管。管边界恢复了轴的无向张量网络视图,而有向内部保留了计算图的操作性解读。关键的重写是等级自然性:在管上滑动眼镜。标准的等变性证明变成了简短的图解推导。我们还展示了如何将我们的重写系统应用于将注意力掩码转换为预处理操作,从而恢复稀疏注意力块的高效实现。
英文摘要:
Architecture diagrams are ubiquitous in deep learning, but they are usually only representational: the tensor-program identities they suggest are still proved by prose and tensor-axis manipulation. We introduce a formal graphical calculus for the structural fragment of tensor programming underlying einops, making such diagrams proof-enabling. Our calculus represents tensor axes as nested graded tubes around a base type. The tube boundary recovers the undirected tensor-network view of axes, while the directed interior retains the operational reading of computation graphs. The key rewrite is grade-naturality: sliding spectacles over tubes. Standard equivariance proofs become short diagrammatic derivations. We additionally demonstrate how our rewrite system may be applied to convert attention masks into pre-processing operations, recovering efficient implementations of sparse attention blocks.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。