![](/img/trans.png)
[英]Python TypeError: unbound method must be called with instance as first argument
[英]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.