技术交流QQ群【JAVA,.NET,BigData,AI】:170933152
1.直接看例子吧
>>> import tensorflow as tf
>>> a = tf.constant([1.0,2.0],name="a") //向量集合
>>> b = tf.constant([2.0,3.0],name="b")
>>> result = a + b //向量计算
>>> sess = tf.session() //这里session首字母大写
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'session'
>>> sess = tf.Session()
>>> sess.run(result) //向量输出结果
array([3., 5.], dtype=float32)
>>> print(a.graph is tf.get_default_graph())
//a的计算图没有特意指定,就是当前默认计算图所以是true,b也是True
>>> print(b.graph is tf.get_default_graph())
True
本文档记录了在Centos7.3环境下,使用TensorFlow通过Python编程创建计算图的实例,旨在提供技术交流。
1842

被折叠的 条评论
为什么被折叠?



