欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

TensorFlow低版本代碼自動升級為1.0版本

 更新時間:2021年02月20日 10:10:02   作者:adrianna_xy  
這篇文章主要介紹了TensorFlow低版本代碼自動升級為1.0版本,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧

Reference:
https://www.tensorflow.org/install/migration

tensorflow 更新到1.0之后,0.n版本不兼容,除了手動更改代碼之外,tensorflow官方還提供了自動更新的腳本。

下載鏈接:https://github.com/tensorflow/tensorflow/tree/master/tensorflow/tools/compatibility

使用方法:

更新一個文件:

原本代碼為foo.py, 使用tf_upgrade.py自動升級為1.0版本,新的文件名為foo-upgraded.py:

tf_upgrade.py --infile foo.py --outfile foo-upgraded.py

目錄下的所有文件都更新:

 tf_upgrade.py --intree InputDir --outtree OutputDir

目錄下的所有文件都更新,并復制除了python文件之外的其他文件到新文件夾:

運行之后所有.py文件都會更新并放在OutputDir目錄下,如果想要目錄中的其他文件(.txt等)也復制到新的文件夾,可以設置

copyotherfiles為True:
tf_upgrade.py --intree InputDir --outtree OutputDir --copyotherfiles True

更新完畢后腳本會自動生成一個log文件,其中包含了更新的內容。

third_party/tensorflow/tools/compatibility/test_file_v0.11.py Line 125

Renamed keyword argument from `dim` to `axis`
Renamed keyword argument from `squeeze_dims` to `axis`

  Old:          [[1, 2, 3]], dim=1), squeeze_dims=[1]).eval(),
                    ~~~~  ~~~~~~~~~~~~~
  New:          [[1, 2, 3]], axis=1), axis=[1]).eval(),
                    ~~~~~  ~~~~~

拓展閱讀

tf_upgrade.py 有一些局限性:

  • 它不能改變 tf.reverse() 的參數(shù),因此必須手動修復。
  • 對于參數(shù)列表重新排序的方法,如 tf.split() 和 tf.reverse_split(),它會嘗試引入關鍵字參數(shù),但實際上并不能重新排列參數(shù)。

有些結構必須手動替換,例如:

tf.get.variable_scope().reuse_variables() 

替換為:

with tf.variable_scope(tf.get.variable_scope(),reuse=True):

到此這篇關于TensorFlow低版本代碼自動升級為1.0版本的文章就介紹到這了,更多相關TensorFlow低版本代碼自動升級 內容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持腳本之家!

相關文章

最新評論