import tensorflow as tf matrix1 = tf.constant([[3, 20]]) matrix2 = tf.constant([[6], [100]]) product = tf.matmul(matrix1, matrix2) # method 1,常规方法 sess = tf.Session() result = sess.run(product) print(result) sess.close() # # method 2,with方法 # with tf.Session() as sess: # # result2 = sess.run(product) # print(result2)
原文地址:https://www.cnblogs.com/yunyaniu/p/8329217.html
时间: 2024-11-09 07:01:53