arXiv:2511.02610cs.LG2025-11被引 2

提出自动迁移神经网络代码的方法,解决跨框架切换难题。

Towards Migrating Neural Network Implementations

  • 用中间抽象模型作为桥梁,实现PyTorch与TensorFlow间代码迁移
  • 在5个神经网络上验证,迁移后功能等价且无需手动修改
  • 适合需频繁切换深度学习框架的团队使用

智能系统的发展得益于神经网络的快速进步,催生了众多支持神经网络设计与实现的库和框架。组织在选择框架时会考虑功能、易用性、文档和社区支持等因素。但后续若性能下降、需求变化或新功能出现,可能需要更换框架。然而,由于缺乏专门针对神经网络的迁移方法,跨库迁移极为困难,导致现代化耗时费力,必须手动更新以避免依赖过时实现并保持对新特性的兼容性。本文提出一种自动迁移深度学习框架中神经网络代码的方法。该方法利用一个中间抽象的神经网络模型,在迁移前对原模型进行抽象。我们在PyTorch和TensorFlow两个主流框架上验证了该方法,并讨论了二者之间代码迁移的挑战及应对策略。在五个神经网络上的实验表明,该方法能成功迁移代码,生成的功能等价于原始模型。相关工具与数据已公开。

原文摘要 · Abstract (English)

The development of smart systems (i.e., systems enhanced with AI components) has thrived thanks to the rapid advancements in neural networks (NNs). A wide range of libraries and frameworks have consequently emerged to support NN design and implementation. The choice depends on factors such as available functionalities, ease of use, documentation and community support. After adopting a given NN framework, organizations might later choose to switch to another if performance declines, requirements evolve, or new features are introduced. Unfortunately, migrating NN implementations across libraries is challenging due to the lack of migration approaches specifically tailored for NNs. This leads to increased time and effort to modernize NNs, as manual updates are necessary to avoid relying on outdated implementations and ensure compatibility with new features. In this paper, we propose an approach to automatically migrate neural network code across deep learning frameworks. Our method makes use of a pivot NN model to create an abstraction of the NN prior to migration. We validate our approach using two popular NN frameworks, namely PyTorch and TensorFlow. We also discuss the challenges of migrating code between the two frameworks and how they were approached in our method. Experimental evaluation on five NNs shows that our approach successfully migrates their code and produces NNs that are functionally equivalent to the originals. Artefacts from our work are available online.

神经网络代码迁移PyTorchTensorFlow

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。