Tensorflow2.x与1.x对比

Tensorflow2.x开篇,拥抱2.x。

1 简介

Tensorflow2.x是一个全新的世界,为开发者带来的不止是变化,更是惊喜,2.x清除了冗余的API,增加了即刻执行、装饰函数@tf.funciton等功能,提升了计算速度。

2 Tensorflow2.x与1.x异同点

Tensorflow2.x与1.x异同点如下介绍。

2.1 不同点

Tensorflow2.x与1.x函数功能不同点如下表(常用):

序号 功能/API Tensorflow2.x Tensorflow1.x
1 Session ×\times \checkmark
2 placeholder ×\times \checkmark
3 graph ×\times \checkmark
4 name_scope ×\times \checkmark
5 autograph \checkmark ×\times
6 keras \checkmark ×\times
7 @tf.function \checkmark ×\times
8 Eager Execution \checkmark ×\times

声明:

  • Tensorflow2.x中仍是Graph结构,只是在使用2.x开发时对开发者是不可见的;
  • Tensorflow2.x中已不推荐使用name_scope管理变量,因为2.0已经自动对变量进行管理;
  • Tensorflow2.x内置了Keras,1.x需要另行安装;

2.2 相同点

Tensorflow2.x保留了部分1.x的功能,共同的部分如下(常用):

  • Tensorboard
  • Estimator
  • 变量和张量
  • 模型
  • TFRecord
  • CPU及GPU训练
  • TPU训练

【参考文献】
[1]https://blog.csdn.net/wc996789331/article/details/86476147
[2]https://tensorflow.google.cn/guide/effective_tf2

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章