ValueError: Variable RNN/MultiRNNCell/Cell0/BasicLSTMCell/Linear/Matrix does not exist, disallowed.

ValueError: Variable RNN/MultiRNNCell/Cell0/BasicLSTMCell/Linear/Matrix does not exist, disallowed. Did you mean to set reuse=None in VarScope?  

問題原因:Jupyter中運行多次cell時,默認在已存在的計算圖上進行相同的操作

解決方法如下:

在代碼上端加with tf.Graph().as_default():

例如:

with tf.Graph().as_default():
    # tf Graph input  
    x = tf.placeholder(tf.float32, [None, n_steps, n_inputs])  
    y = tf.placeholder(tf.float32, [None, n_classes])  


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章