解決 AttributeError: module 'tensorflow.python.ops.variable_scope' has no attribute '_VARSCOPE_KEY'

在學(xué)習(xí)?Knifey-Spoony數(shù)據(jù)集上做分類的神經(jīng)網(wǎng)絡(luò)。它將Inception模型得到的transfer-values作為輸入,運(yùn)行報(bào)如下兩個(gè)錯(cuò)

/usr/local/lib/python3.5/dist-packages/prettytensor/scopes.py in var_and_name_scope(names)

53 ? ? ? ? full_name = var_scope.name

54

---> 55 ? ? ? vs_key = tf.get_collection_ref(variable_scope._VARSCOPE_KEY)

56 ? ? ? try:

57 ? ? ? ? # TODO(eiderman): Remove this hack or fix the full file.

AttributeError: module 'tensorflow.python.ops.variable_scope' has no attribute '_VARSCOPE_KEY'

修改tf.get_collection_ref(variable_scope._VARSCOPE_KEY)

未 tf.get_collection_ref(variable_scope._VARSCOPESTORE_KEY)

/usr/local/lib/python3.5/dist-packages/tensorflow/python/ops/variable_scope.py in get_variable_scope()

1347 def get_variable_scope():

1348 ? """Returns the current variable scope."""

-> 1349 ? return get_variable_scope_store().current_scope

AttributeError: 'VariableScope' object has no attribute 'current_scope'

在如下 加入? 寫(xiě)錯(cuò)了?

def _get_unique_variable_scope(prefix):

"""Get a name with the given prefix unique in the current variable scope."""

var_scope_store = get_variable_scope_store()

?current_scope = get_variable_scope()

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

友情鏈接更多精彩內(nèi)容