TensorFlow
TensorFlow 是一个端到端开源机器学习平台。借助 TensorFlow,初学者和专家可以轻松地创建机器学习模型。
TensorFlow 2.0
2018年11月,TensorFlow迎来了三周岁的生日。三年来,TensorFlow发生了很多变化。
那么,TensorFlow 2.0 有哪些新的变化呢?根据官方博文《What’s coming in TensorFlow 2.0》(https://medium.com/tensorflow/whats-coming-in-tensorflow-2-0-d3663832e9b8),描述如下:
TensorFlow 2.0 will focus on simplicity and ease of use, featuring updates: Easy model building with Keras and eager execution. Robust model deployment in production on any platform. Powerful experimentation for research. Simplifying the API by cleaning up deprecated APIs and reducing duplication. TensorFlow
TensorFlow 2.0 侧重于简单性和易用性,其中包含一些更新,例如即刻执行、直观的更高阶 API 、轻松地构建模型、在任何平台上的生产环境中可靠地部署模型,以及强大的研究实验。
Eager Execution 是一种命令式编程环境,可立即评估操作。此环境对于 Keras 并不是必需的,但是受 tf.keras 的支持,并且可用于检查程序和调试。
借助 TensorFlow 的高阶 API Keras,刚开始接触机器学习的开发者能够更轻松地开始使用 TensorFlow。
安装
安装 TensorFlow 2.0 测试预览版软件包:
pip install tensorflow==2.0.0-beta0
安装可能会有一些环境问题,只要根据提示信息解决即可:
问题描述: ERROR: tb-nightly 1.14.0a20190603 has requirement setuptools>=41.0.0, but you'll have setuptools 39.1.0 which is incompatible. 解决方案: pip install --upgrade setuptools 问题描述: Installing collected packages: wrapt, google-pasta, tensorflow Found existing installation: wrapt 1.10.11 ERROR: Cannot uninstall 'wrapt'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall. 解决方案:旧版本依赖多,不能清晰的删除,此时应该忽略旧版本升级,即如下 pip install wrapt --ignore-installed
然后我们就可以在代码里引用TensorFlow:
>> import tensorflow as tf >> tf.__version__ '2.0.0-beta0'
更多TensorFlow基础,可以收看《Getting Started with TensorFlow 2.0 (Google I/O'19)》(https://www.youtube.com/watch?v=lEljKc9ZtU8)
还没有评论,来说两句吧...