tensorflow1.X会话求值 编程语言 > 机器学习 tensorflow python 发布时间 : 2020-07-05 00:00 字数:38 阅读 : 12345678910111213141516import tensorflow as tf var1 = tf.constant([1], tf.float32)sess = tf.Session(); sess.run(tf.global_variables_initializer())#方法一value1_var1 = sess.run(var1)print(value1_var1)#[1.]#方法二value2_var1 = var1.eval(session=sess)print(value2_var1)#[1.] 转载请注明来源 https://tianweiye.github.io