简体   繁体   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

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.

相关问题 Python TypeError:必须以实例作为第一个参数调用未绑定方法 - Python TypeError: unbound method must be called with instance as first argument 必须使用instance作为第一个参数调用unbound方法 - unbound method must be called with instance as first argument TypeError:必须使用“Class name”实例作为第一个参数调用unbound方法“method name”(改为使用str实例) - TypeError: unbound method “method name” must be called with “Class name” instance as first argument (got str instance instead) Python-TypeError:未绑定的方法beamDeflection()必须以Beam实例作为第一个参数调用(取而代之的是获取列表实例) - Python - TypeError: unbound method beamDeflection() must be called with beam instance as first argument (got list instance instead) TypeError:未绑定方法sadd()必须以StrictRedis实例作为第一个参数来调用(取而代之的是str实例) - TypeError: unbound method sadd() must be called with StrictRedis instance as first argument (got str instance instead) TypeError:必须以JSONDecoder实例作为第一个参数来调用未绑定的方法encode()(改为使用PrintJson实例) - TypeError: unbound method decode() must be called with JSONDecoder instance as first argument (got PrintJson instance instead) 错误消息:“ TypeError:必须使用日志实例作为第一个参数来调用未绑定方法w()(而是使用got str实例)” - Error message: “TypeError: unbound method w() must be called with log instance as first argument (got str instance instead)” TypeError:必须以LoginPage实例作为第一个参数来调用未绑定方法test_logn()(改为使用CompanyManagement实例) - TypeError: unbound method test_logn() must be called with LoginPage instance as first argument (got CompanyManagement instance instead) TypeError:必须使用实例作为第一个参数(在Python 2中使用int实例)调用unbound方法 - TypeError: unbound method must be called with instance as first argument (got int instance instead) in Python 2 TypeError:未绑定方法“方法名称”必须以“类名称”实例作为第一个参数来调用(取而代之的是str实例) - TypeError: unbound method 'method name' must be called with 'class name' instance as first argument (got str instance instead)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM