Skip to content

Commit b5e2680

Browse files
author
Mofan Zhou
committed
create tensorflow6
1 parent 1066bdc commit b5e2680

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

‎tensorflow/tensorflow6_session.py‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import tensorflow as tf
2+
3+
matrix1 = tf.constant([[3,3]])
4+
matrix2 = tf.constant([[2],
5+
[2]])
6+
7+
product = tf.matmul(matrix1, matrix2) # np.dot()
8+
9+
# method 1
10+
sess = tf.Session()
11+
result = sess.run(product)
12+
print(result)
13+
sess.close()
14+
15+
# method 2
16+
with tf.Session() as sess:
17+
result2 = sess.run(product)
18+
print(result2)

0 commit comments

Comments
 (0)