首页 > 解决方案 > 在 TensorFlow 中重置图形

问题描述

我有一个为我创建 LSTM 模型的块。我想迭代这个块,每次都将一个新数据作为参数传递给它。但它引发了这个错误:

ValueError: Variable rnn/lstm_cell/kernel already exists, disallowed. Did you mean to set reuse=True or reuse=tf.AUTO_REUSE in VarScope?

我用谷歌搜索了它,我发现通过在块的开头使用这段代码重置模型,我可以解决错误:

tf.reset_default_graph()

但它引发了另一个错误:

ValueError: Tensor("lstm/rnn/Const:0", shape=(1,), dtype=int32) must be from the same graph as Tensor("ExpandDims:0", shape=(1,), dtype=int32).

我现在该怎么办?多谢

标签: tensorflowlstmtensor

解决方案


推荐阅读