标签:multi col method on() matrix ssi eth style 文件
session 是一个会话控制
import tensorflow as tf matrix1 = tf.constant([[3, 3]]) matrix2 = tf.constant([[2], [2]]) product = tf.matmul(matrix1, matrix2) # matrix multiply np.dot(m1, m2) # method 1 sess = tf.Session() result = sess.run(product) print(result) sess.close() # method 2 with tf.Session() as s: result = s.run(product) print(result)
第二种方法类似于文件的with,他会在结束时候关闭session
标签:multi col method on() matrix ssi eth style 文件
原文地址:https://www.cnblogs.com/francischeng/p/9690230.html