1十、TensorFlow张量值的计算

import tensorflow as tf
#placeholders在没有提供具体值的时候不能使用eval方法来计算它的值
# 另外的建模方法可能会使得模型变得复杂
# TensorFlow 不能再session尚未开启的时候就计算张量的值
p = tf.placeholder(tf.float32)
t = p + 1.0
init = tf.global_variables_initializer()
with tf.Session() as sess:
    print(t.eval(feed_dict={p:2.0}))

下面是计算的结果html

2018-02-16 21:46:48.085119: I C:\tf_jenkins\workspace\rel-win\M\windows\PY\35\tensorflow\core\platform\cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2
[1 4 9]

 

转载于:https://www.cnblogs.com/weizhen/p/8450630.htmlwindows