Tensorflow学习二 Session

import tensorflow as tf
matrix1 = tf.constant([[3,3]])#矩阵
matrix2 = tf.constant([[2],[2]])
product = tf.matmul(matrix1,matrix2)#矩阵相乘
#
# #methid 1
# see = tf.Session()
# result = see.run(product)
# print(result)
# see.close()

#method2
with tf.Session() as sess:
    result2 = sess.run(product)
    print(result2)

猜你喜欢

转载自blog.csdn.net/weixin_43408956/article/details/93380279
今日推荐