tensorflow - 在 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).
我现在该怎么办?多谢
解决方案
推荐阅读
- javascript - 如何在打字稿中预先输入 React 元素数组
- angular - 等待 Observable 的数据
- npm - 从 Mac OS 中删除 Yarn/NVM/Node
- perl - 即使禁用 SSL 检查,LWP::UserAgent 也会导致 SSL 失败?
- r - R中差分函数的概率函数和标准差
- java - 使用带有 ip 的树莓派 4“ubuntu 服务器”的 CORS 错误
- swift - 如何在 SwiftUI 中显示来自 url 的图像
- c++ - 在 C++ 中创建一个密码生成器,将密码保存在 .txt 中
- python - 如何打开无法启动的pygame窗口?
- python - 将 DCM 转换为 CSV 时由于缺少标签而导致 KeyError