# DLCodeTranslator **Repository Path**: aiconntest/dlcode-translator ## Basic Information - **Project Name**: DLCodeTranslator - **Description**: 深度学习框架神经网络代码转换工具 - **Primary Language**: Unknown - **License**: GPL-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 22 - **Forks**: 8 - **Created**: 2025-03-17 - **Last Updated**: 2025-08-11 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 代码转换工具 ## 工具介绍 本工具的主要功能为实现不同深度学习框架间神经网络模型代码的自动转换 ## 项目文件架构 ``` ├─conversion │ ├─operator_mapper │ │ └─__pycache__ │ ├─utils │ └─__pycache__ ├─okg │ ├─cypher │ │ ├─module │ │ │ ├─torch │ │ │ ├─torch.nn │ │ │ ├─torch.nn.functional │ │ │ ├─torch.optim │ │ │ ├─torchvision.datasets │ │ │ └─torchvision.transforms │ │ ├─new │ │ └─old │ ├─scripts │ │ └─__pycache__ │ ├─__pycache__ │ └─设计文档 └─test ├─source_code ├─source_custom_operator ├─source_functional ├─source_net ├─target_custom_operator │ └─source_custom_operator ├─target_functional │ └─source_functional ├─target_net │ └─source_net └─target_project ├─source_code ├─source_custom_operator └─source_functional ``` 1. okg okg文件是算子知识图谱的构建以及与迁移脚本交互的文档。 1. scripts文件夹中存放插入cypher语句的脚本文件,其中insert文件是将映射文件批量导入图数据库 的脚本;match是连接图数据库并提供给迁移脚本调用相关图谱映射信息的文件。 2. cypher文件夹中存放各种算子及其映射关系的cypher语句。 readme.md 2024-04-22 2. conversion transformers是迁移程序的主体程序,X2mindspore_mapper中存有一些提供给迁移程序使用 的辅助迁移函数。 3. test test文件夹中存放有测试函数以及源与目标模型代码文件,其中source_code中存放源代码文件, target_code中存放目标代码文件,main文件是测试文件。 ## 环境依赖 1. 安装neo4j图数据库 2. 安装py2neo库 ``` pip install py2neo ``` ## 运行步骤 1. 运行neo4j并创建图数据库 2. 修改okg文件夹下的insert文件中的连接数据库的用户名密码及端口号 3. 运行insert文件,将算子映射信息导入图数据库 4. 在test文件夹下的运行main文件,即可在target_code文件夹中生成对应的目标模型代码