[英]Tensorflow CPU-only:TypeError: unbound method _as_graph_element() must be called with Variable instance as first argument
I use Tensorflow without GPU, only CPU. 我使用Tensorflow而没有GPU,只有CPU。 I installed it with
pip install tensorflow
. 我用
pip install tensorflow
安装了它。 My Ubuntu17 has Python3, but when I pip install tensorflow
, It uses Python2. 我的Ubuntu17具有Python3,但是当我
pip install tensorflow
,它使用Python2。
My code look like this: 我的代码如下所示:
h_conv1 = tf.nn.relu(conv2d(x_image, W_conv1) + b_conv1)
I get this error. 我得到这个错误。
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]
What does this mean? 这是什么意思? Now I'm trying to use python3 instead, could that help?
现在我正尝试使用python3,这能帮上忙吗?
It is really difficult to understand the error without the context. 没有上下文,很难理解错误。 Maybe your dimensions for either of x_image or W_conv1 are wrong.
也许x_image或W_conv1的尺寸是错误的。 Maybe you forgot to initialize the weights?
也许您忘了初始化权重?
You are more likely to get answers if you add a bit of context (reproducible if possible) code. 如果添加一些上下文(如果可能的话是可重现的)代码,则更有可能获得答案。
Edit: install pip3 and do pip3 install package to install python3 packages (if this is also a part of your question) 编辑:安装pip3并执行pip3 install 软件包以安装python3软件包(如果这也是您的问题的一部分)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.