簡體   English   中英

Tensorflow僅CPU:TypeError:必須以變量實例作為第一個參數調用未綁定方法_as_graph_element()

[英]Tensorflow CPU-only:TypeError: unbound method _as_graph_element() must be called with Variable instance as first argument

我使用Tensorflow而沒有GPU,只有CPU。 我用pip install tensorflow安裝了它。 我的Ubuntu17具有Python3,但是當我pip install tensorflow ,它使用Python2。

我的代碼如下所示:

h_conv1 = tf.nn.relu(conv2d(x_image, W_conv1) + b_conv1)

我得到這個錯誤。

TypeError: unbound method _as_graph_element() must be called with Variable instance as first argument (got nothing instead)
[Finished in 2.2s with exit code 1]

這是什么意思? 現在我正嘗試使用python3,這能幫上忙嗎?

沒有上下文,很難理解錯誤。 也許x_image或W_conv1的尺寸是錯誤的。 也許您忘了初始化權重?

如果添加一些上下文(如果可能的話是可重現的)代碼,則更有可能獲得答案。

編輯:安裝pip3並執行pip3 install 軟件包以安裝python3軟件包(如果這也是您的問題的一部分)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM