TensorFlow2.0 出来了!
TensorFlow2.0开启默认模式是eager模式。什么是eager模式?说白了命令行交互模式,和我们写python一样的体验,写完一句代码,按下回车立刻就知道了结果。不用事事不离tf.Session run了,那个像阴魂不散的sess.run终于一去不复返了!TensorFlow2.0在推理性能上比之前的版本提供4-5倍。笔者小试了几行代码,的确很酸爽!
在TensorFlow 1.12版本里是上面图片这样的算一个数据softmax;
在TensorFlow 2.0是下面图片这样的:
的确是简洁方便了!!!
1.x升级到2.0的诸多问题。。。
但是,有个很大的问题,就是对之前1.x的代码不再兼容了;什么不再兼容了?如果直接运行1.x的代码,会直接报错。
2019-01-23 11:20:11.812640: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX22019-01-23 11:20:12.015686: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 3408000000 Hz2019-01-23 11:20:12.015853: I tensorflow/compiler/xla/service/service.cc:162] XLA service 0x1cd7b40 executing computations on platform Host. Devices:2019-01-23 11:20:12.015871: I tensorflow/compiler/xla/service/service.cc:169] StreamExecutor device (0): , Traceback (most recent call last):File "tf_collection.py