1. 程式人生 > 其它 >開發 | 谷歌釋出TensorFlow 1.4版本:支援分散式訓練,迎來三大新變化

開發 | 谷歌釋出TensorFlow 1.4版本:支援分散式訓練,迎來三大新變化

e Developers blog正式撰文釋出TensorFlow 1.4版本,此次的更新迎來三個重大變化:Keras位於TensorFlow core中,Dataset API支援更多功能,引入效用函式tf.estimator.train_and_evaluate等等。

AI科技評論編輯整理如下:

TensorFlow 1.4目前已經公開,這次迎來重大更新。此次更新後,將支援很多新的、令人興奮的特徵,希望大家都能滿意。

Keras

在TensorFlow 1.4版本中,Keras從tf.contrib.keras轉移到tf.keras核心包。Keras目前是一個廣受歡迎的機器學習框架,它的高階API介面能大大縮短從付諸想法到實踐的時間。Keras平滑地集成了其他core TensorFlow功能,包括Estimator API。

事實上,通過呼叫tf.keras.estimator.model_to_estimator函式,大家可以從任何Keras模型中構建Estimator。

此次更新後,Keras處於TensorFlow core中了,大家可以在自己的產品工作流中用到它。

想要了解更多關於Keras的相關知識,請閱讀如下連結:

簡單介紹
https://keras.io/#getting-started-30-seconds-to-keras

Keras Sequential model API指南
https://keras.io/getting-started/sequential-model-guide/

Keras Functional model API指南
https://keras.io/getting-started/functional-api-guide/

想要了解更多關於Estimator的相關知識,請閱讀如下連結:

介紹TensorFlow Estimator和資料集的博文
https://developers.googleblog.com/2017/09/introducing-tensorflow-datasets.html

資料集

TensorFlow 1.4版本中,Dataset API從tf.contrib.data中轉移到tf.data核心包。新版Dataset API將支援Python生成器。強烈建議大家使用Dataset API來為TensorFlow模型建立input pipeline,原因有如下幾點:

  • 比起老版的API,這次更新的Dataset API提供了更多功能(feed_dict函式、基於佇列的pipeline)
  • Dataset API執行效果更好
  • Dataset API更乾淨,更易於使用

未來的開發重點將放在Dataset API上,而不是著眼於之前的API。如果想使用資料集,請閱讀如下說明:

介紹TensorFlow Estimator和資料集的博文(連結如上)

TensorFlow程式設計師資料匯入篇指南
https://www.tensorflow.org/versions/r1.4/programmers_guide/datasets

介紹Dataset API的幻燈片(帶有講者註釋)
http://.cn/RlWCD1b

分散式訓練&評估Estimator

TensorFlow 1.4還引入了效用函式tf.estimator.train_and_evaluate,這能簡化訓練、評估以及

輸出Estimator模型的過程。該函式在訓練和評估過程中能支援分散式執行,同時也仍然支援本地執行。

其他增強功能

除了前面所述的一系列功能,TensorFlow 1.4還引入了一些額外的增強功能,在Release Note有詳細描述。

地址:
https://github.com/tensorflow/tensorflow/blob/master/RELEASE.md

安裝TensorFlow 1.4

目前可以使用標準pip來安裝TensorFlow 1.4版本。

# Note: the following command will overwrite any existing TensorFlow

# installation.

$ pip install --ignore-installed --upgrade tensorflow

# Use pip for Python 2.7

# Use pip3 instead of pip for Python 3.x

另外,tensorflow.org中的檔案也已更新到1.4版本。

最後,TensorFlow的強大功能依賴於社群中的貢獻者們,非常感謝大家幫助我們一起進行開發。還沒有加入我們社群的人,請不要猶豫,大家一起在GitHub開發原始碼或者在Stack Overflow上幫助回答問題吧。

希望你們都能喜歡這些新功能。