import tensorflow as tf
m1 = tf.constant([[2, 2]])
m2 = tf.constant([[3],
[3]])
dot_operation = tf.matmul(m1, m2)
print(dot_operation) # 这里并没有结果
# 使用seesion ,方法1
sess = tf.Session()
result = sess.run(dot_operation)
print(result)
sess.close()
# 使用seesion ,方法2
with tf.Session() as sess:
result_ = sess.run(dot_operation)
print(result_)
使用seesion的方法
最新推荐文章于 2023-06-09 11:05:53 发布