Python 2.7.12 (default, Nov 20 2017, 18:23:56)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
>>> a = tf.add(2,3)
>>> a
<tf.Tensor 'Add:0' shape=() dtype=int32>
>>> b = tf.add(3.0,5.0)
>>> b
<tf.Tensor 'Add_1:0' shape=() dtype=float32>
>>> sess = tf.Session()
2018-01-03 14:24:40.035399: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA
>>> print sess.run(a)
5
>>> sess.close()
>>> sess = tf.Session()
>>> print sess.run(b)
8.0
>>> sess.close()
>>> x = 2
>>> y = 3
>>> op1 = tf.add(x,y)
>>> op2 = tf.mul(x,y)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'mul'
>>> op3 = tf.pow(op2,op1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'op2' is not defined
>>> op2 = tf.multiply(x,y)
>>> op3 = tf.pow(op2,op1)
>>> sess
<tensorflow.python.client.session.Session object at 0x7f3e7c7a6410>
>>> sess.run(op3)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 889, in run
run_metadata_ptr)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 1047, in _run
raise RuntimeError('Attempted to use a closed Session.')
RuntimeError: Attempted to use a closed Session.
>>> sess = tf.Session()
>>> sess.run(op3)
7776
>>> useless = =tf.multiply(x,op1)
File "<stdin>", line 1
useless = =tf.multiply(x,op1)
^
SyntaxError: invalid syntax
>>> useless = tf.multiply(x,op1)
>>> sess.run([op3,useless])
[7776, 10]