Variable W already exists, disallowed. Did you mean to set reuse=True or reuse=tf.AUTO_REUSE……
生活随笔
收集整理的這篇文章主要介紹了
Variable W already exists, disallowed. Did you mean to set reuse=True or reuse=tf.AUTO_REUSE……
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
Variable W already exists, disallowed. Did you mean to set reuse=True or reuse=tf.AUTO_REUSE in VarScope? Originally defined at
解決方案:
加入:tf.reset_default_graph()
我的情況是:模型代碼在文檔里面,用Notebook進(jìn)行加載,發(fā)現(xiàn)重復(fù)運(yùn)行兩次相同的代碼就會出現(xiàn)上述錯誤。
一開始我的模型源碼不同的位置加入均無法正常通過,報各種錯誤;
最后在Notebook里面需要運(yùn)行的block中加入
tf.reset_default_graph()
import tensorflow as tf tf.reset_default_graph() json_pritimive = "******.custom.nlp.Textcnn" obj = AIPrimitive() obj.load_from_json(json_pritimive) obj.fit(X=X_tokenized,y=y_train) X_predict = obj.produce(X=X_tokenized)就運(yùn)行正常了
總結(jié)
以上是生活随笔為你收集整理的Variable W already exists, disallowed. Did you mean to set reuse=True or reuse=tf.AUTO_REUSE……的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 新建notebook时发现在notebo
- 下一篇: 如何改变本地git的根目录