import tensorflow as tf
matrix1 = tf.constant([[3, 3]])
matrix2 = tf.constant([[2],
[2]])
product = tf.matmul(matrix1, matrix2)
# method 1
sess = tf.Session()
result = sess.run(product)
print('result:', result)
# method 2,跳出with说明session会话结束了
with tf.Session() as sess:
result2 = sess.run(product)
print('result2:', result2)
tensorflow学习笔记(2) - Session会话
最新推荐文章于 2025-03-20 17:15:07 发布