`
7wolfs
  • 浏览: 185694 次
  • 性别: Icon_minigender_1
  • 来自: 济南
社区版块
存档分类
最新评论

Tensorflow初探

阅读更多
1、安装 tensorflow
Pip install tensorflow -i https://pypi.tuna.tsinghua.edu.cn/simple
安装时,为了加快下载资源速度,使用 i 参数,选择了国内镜像站点。

2、用helloworld代码tensorflow是否安装成功
import tensorflow as tf
tf.compat.v1.disable_eager_execution()
hello = tf.constant('Hello, TensorFlow!')
sess = tf.compat.v1.Session()
print(sess.run(hello))

说明:
由于tf.Session()是tf1里的写法,在tf2里已经没有该方法,需要使用兼容写法来调用,用法在示例代码中已演示。

备注:
如果使用辅助工具Anaconda,可以在国内镜像资源站点上下载。
https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-5.0.0-Windows-x86_64.exe

参考:
https://stackoverflow.com/questions/55142951/tensorflow-2-0-attributeerror-module-tensorflow-has-no-attribute-session
https://www.jianshu.com/p/e2dd167d2892
0
0
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics