【发布时间】:2019-10-26 18:49:15
【问题描述】:
如何编辑 sessions.run 函数,使其在 Tensorflow 2.0 上运行?
with tf.compat.v1.Session(graph=graph) as sess:
start = time.time()
results = sess.run(output_operation.outputs[0],
{input_operation.outputs[0]: t})
我阅读了over here 的文档并了解到您必须更改这样的函数:
normalized = tf.divide(tf.subtract(resized, [input_mean]), [input_std])
sess = tf.compat.v1.Session()
result = sess.run(normalized)
return result
到这里:
def myFunctionToReplaceSessionRun(resized,input_mean,input_std):
return tf.divide(tf.subtract(resized, [input_mean]), [input_std])
normalized = myFunctionToReplaceSessionRun(resized,input_mean,input_std)
但我不知道如何更改第一个。
这里有一点上下文,我在尝试this 代码实验室,并在其中发现sess.run,这给我带来了麻烦。
This is the command line output when running the label_images file.
【问题讨论】:
标签: python tensorflow tensorflow2.0