【发布时间】:2016-06-27 06:44:16
【问题描述】:
1 个空图错误
嘿,我正在尝试完全分开运行多个张量流图,但遇到了以下继承问题。
还有
import tensorflow as tf
class A:
g = tf.Graph()
g.as_default()
s = tf.Session(graph=g)
x = tf.placeholder(tf.float32)
__call__ = lambda self,X: self.s.run(self.y, {self.x:X})
class B(A):
y = 2 * A.x
test = B()
print test([1,1,2])
错误
RuntimeError: The Session graph is empty. Add operations to the graph before calling run()
2 - 垃圾收集
我也很想知道删除这些不同的图,如果我用 Session().close() 关闭会话并且它是唯一知道该图的会话,该图现在会消失并被垃圾收集吗?
【问题讨论】:
标签: tensorflow