1. 程式人生 > >Tensorflow 低版本程式碼自動升級為1.0版本

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