Tensorflow 低版本代码自动升级为1.0版本

TensorFlow 1.0 中的 API 有所变化,参数位置发现变化,造成在 TensorFlow 0.n 上运行的 TensorFlow 程序无法在 TensorFlow 1.0 上运行。

自动将代码移植到 1.0,有一个转换工具。

GitHub工具包地址:https://github.com/tensorflow/tensorflow/tree/master/tensorflow/tools/compatibility

要将单个 0.n 版 TensorFlow 源文件转换为 1.0 版,请输入以下格式的命令:

python tf_upgrade.py --infile test.py --outfile test_1.0.py

tf_upgrade.py 脚本还会生成一个名为 report.txt 的文件,详细说明其所执行的所有变动。

还有其他详细操作以及一些需要手动修改的地方参考这个文章:

https://tensorflow.google.cn/install/migration

猜你喜欢

转载自blog.csdn.net/qq_33373858/article/details/83790743