arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~

从零开始的自动微分:PyTorch如何在物理信息神经网络中计算梯度

Automatic Differentiation from Scratch: How PyTorch Computes Gradients in Physics-Informed Neural Networks

Abdeladhim Tahimi

arXiv 2607.13042首次发表:更新:

发表机构

CECA, Universidade Federal de Alagoas (UFAL)(塞阿拉,阿拉戈斯联邦大学)

机构由 AI 辅助整理,请以论文原文为准。

AI 中文总结

研究PyTorch在物理信息神经网络中计算梯度的方式,借助1-3-3-1多层感知器和特定初值问题,追踪前向传播计算图、反向遍历及图中图机制,验证伴随值并联系相关框架与积,明确其计算梯度的完整流程。

AI 中文摘要

本文通过明确的数值,追踪PyTorch的自动微分(AD)引擎如何为物理信息神经网络(PINN)训练计算梯度,该设置需要两级微分。使用1-3-3-1多层感知器和初值问题\(y'(t)+y(t)=0\),\(y(0)=1\),我们在每个节点追踪完整流程,包括前向传播构建的计算图、反向模式反向遍历以及图中图机制。每个伴随值都与Tahimi(2026)的手动推导进行验证,将\(P/Q\)灵敏度框架与PyTorch自动求导引擎使用的向量-雅可比积联系起来。

英文摘要

This paper traces, with explicit numerical values, how PyTorch's automatic differentiation (AD) engine computes gradients for Physics-Informed Neural Network (PINN) training -- a setting that requires two levels of differentiation: computing the physics derivative $\hat{y}'(t)=d\hat{y}/dt$ through the network, and computing parameter gradients $\nabla_θL$ of a loss that itself depends on $\hat{y}'(t)$. Using a 1-3-3-1 multilayer perceptron and the initial value problem $y'(t)+y(t)=0$, $y(0)=1$, we trace the complete pipeline at every node: the computational graph built during the forward pass, the reverse-mode backward traversal that computes all 22 parameter gradients in a single pass, and the graph-on-graph mechanism by which \texttt{create\_graph=True} enables correct differentiation through the physics-informed residual. Every adjoint value is verified against the hand derivations of Tahimi (2026), connecting the $P/Q$ sensitivity framework to the vector--Jacobian products used by PyTorch's autograd engine.

Comments25 pages, 9 figures. Educational tutorial on automatic differentiation for Physics-Informed Neural Networks (PINNs) using PyTorch. Includes complete numerical derivations and computational graph analysis

论文原文

arXiv 摘要页 · PDF 原文 · HTML 原文

↑