概述
简介
本章节介绍如何使用TensorFlow的xlacompile工具,将有控制流算子的网络模型(如图1所示)转成函数类算子的网络模型(如图2所示),然后利用ATC工具转换成适配昇腾AI处理器的离线模型。
使用前提
- 确保ATC工具所在服务器能连接网络。
- 安装bazel编译工具。
请参见https://docs.bazel.build/versions/master/install-ubuntu.html官方地址安装bazel编译工具。
- 安装TensorFlow以及依赖future。
ATC安装路径下的func2graph.py脚本依赖TensorFlow,使用pip3.7.5 list查看列表中是否有TensorFlow依赖,若有则不用安装,否则执行如下命令安装:
pip3.7.5 install tensorflow==1.15 --user
bazel编译工具依赖python,请使用pip3.7.5 list命令查看是否安装future、patch,若有则不用安装,否则执行如下命令安装:
pip3.7.5 install future --user pip3.7.5 install patch --user pip3.7.5 install numpy --user
如果执行上述命令时无法连接网络,且提示“Could not find a version that satisfies the requirement xxx”,请参见使用pip3.7.5 install软件时提示" Could not find a version that satisfies the requirement xxx"解决。
父主题: 定制网络修改(TensorFlow)