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 "", line 1, inAttributeError: '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