admin管理员组文章数量:1666865
安装
第一步:安装pip
npm install pip
第2步:安装命令
pip install https://storage.googleapis/tensorflow/mac/tensorflow-0.5.0-py2-none-any.whl
第3步:测试 导入tensorflow如果不报错就成功
promote:~ apple$ import tensorflow
测试案例:
promote:~ apple$ python
Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec 5 2015, 12:54:16)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sklearn/cross_validation.py:44: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the refactored classes and functions are moved. Also note that the interface of the new CV iterators are different from that of this module. This module will be removed in 0.20.
"This module will be removed in 0.20.", DeprecationWarning)
>>> cat hello_tensorflow.py
File "<stdin>", line 1
cat hello_tensorflow.py
^
SyntaxError: invalid syntax
>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> meaning = tf.constant('The Answer to Life, the Universe and Everything is ')
>>> sess = tf.Session()
>>> msg_op = sess.run(hello)
>>> mean_op = sess.run(meaning)
>>> print(msg_op)
Hello, TensorFlow!
>>> print(mean_op)
The Answer to Life, the Universe and Everything is
>>> a = tf.constant(10)
>>> b = tf.constant(32)
>>> cal_op = sess.run(a + b)
>>> print(cal_op)
42
>>> sess.close()
>>>
本文标签: 模块深度测试tensorflow
版权声明:本文标题:[深度学习]tensorflow模块安装与测试 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/dianzi/1730077154a1221928.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论