溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

如何解決Tensorflow由于版本問題出現(xiàn)的幾種錯誤

發(fā)布時間:2021-08-05 10:36:15 來源:億速云 閱讀:139 作者:小新 欄目:開發(fā)技術(shù)

這篇文章主要為大家展示了“如何解決Tensorflow由于版本問題出現(xiàn)的幾種錯誤”,內(nèi)容簡而易懂,條理清晰,希望能夠幫助大家解決疑惑,下面讓小編帶領(lǐng)大家一起研究并學(xué)習(xí)一下“如何解決Tensorflow由于版本問題出現(xiàn)的幾種錯誤”這篇文章吧。

1、AttributeError: 'module' object has no attribute 'rnn_cell'

S:將tf.nn.rnn_cell替換為tf.contrib.rnn

2、TypeError: Expected int32, got list containing Tensors of type '_Message' instead.

S:由于tf.concat的問題,將tf.concat(1, [conv1, conv2]) 的格式替換為tf.concat( [conv1, conv2],1)

3、AttributeError: 'module' object has no attribute 'pack'

S:將pack替換為stack

4、ValueError: Only call `softmax_cross_entropy_with_logits` with named arguments (labels=..., logits=..., ...)

S:按照提示,需要將括號內(nèi)的形參寫出,即(logits=pre, lables=tru)而非(pre,tru)

5、ValueError: Variable Wemb/Adam/ does not exist, or was not created with tf.get_variable(). Did you mean to set reuse=None in VarScope?

S:需要定義scope,雖然報錯可能是在optimizer處提示,但需要在定義模型時增加scope,即

with tf.variable_scope(tf.get_variable_scope()) as scope:
# model construction

以上是“如何解決Tensorflow由于版本問題出現(xiàn)的幾種錯誤”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對大家有所幫助,如果還想學(xué)習(xí)更多知識,歡迎關(guān)注億速云行業(yè)資訊頻道!

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI