'NoneType'对象不可调用

时间:2018-03-20 02:47:27

标签: python tensorflow

更新:尝试了代码并仍然得到了同样的错误:
updated: tried the code and still got the same error

import tensorflow as tf
    x = tf.placeholder(dtype, shape=shape, name=name)

然后出现此错误。

  

TypeError:'NoneType'对象不可调用

     

dtype,shape,name

1 个答案:

答案 0 :(得分:-1)

这就是你应该如何定义一个安置者

x = tf.placeholder(tf.float32, shape=(1024, 1024))

如果您希望与代码保持一致,则必须初始化代码中使用的变量

>>> import tensorflow as tf
>>> shape=(1024,1024)
>>> dtype=tf.float32
>>> name = "input"
>>> x = tf.placeholder(dtype, shape=shape, name=name)

编辑:这是我运行代码时获得的

>>> import tensorflow as tf
>>> x = tf.placeholder(dtype, shape=shape, name=name)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'dtype' is not defined
>>> 
相关问题