“ NoneType”对象没有属性“ new_TF_Output”

时间:2019-05-06 04:51:26

标签: python tensorflow

当我尝试使用Python 2.7在spyder控制台上运行Keras代码时,出现此错误,提示没有'new_TF_Output'属性。

此处的整个追溯仅供参考:

File "<ipython-input-7-f9bf405379e5>", line 1, in <module>
runfile('.../mainK.py', wdir='/home/abhi/Documents/Hyper/CNN/HyperXKeras')

File ".../dist-packages/spyder/utils/site/sitecustomize.py", line 705, in runfile
execfile(filename, namespace)

File ".../dist-packages/spyder/utils/site/sitecustomize.py", line 94, in execfile
builtins.execfile(filename, *where)

File ".../mainK.py", line 187, in <module>
model,model_name, optimizer, loss, hyperparams = model(MODEL, **hyperparams)

File "model_keras.py", line 89, in get_model
model,model_name = model.build(n_bands, n_classes, patch_size=patch_size)

File "model_keras.py", line 417, in build
input_x=Input(shape=(1,input_channels,patch_size,patch_size))

File ".../dist-packages/keras/engine/topology.py", line 1439, in Input
input_tensor=tensor)

File ".../dist-packages/keras/legacy/interfaces.py", line 87, in wrapper
return func(*args, **kwargs)

File ".../dist-packages/keras/engine/topology.py", line 1348, in __init__
name=self.name)

File ".../dist-packages/keras/backend/tensorflow_backend.py", line 497, in placeholder
x = tf.placeholder(dtype, shape=shape, name=name)

File ".../site-packages/tensorflow/python/ops/array_ops.py", line 1808, in placeholder
return gen_array_ops.placeholder(dtype=dtype, shape=shape, name=name)

File ".../site-packages/tensorflow/python/ops/gen_array_ops.py", line 4848, in placeholder
"Placeholder", dtype=dtype, shape=shape, name=name)

File ".../site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)

File ".../site-packages/tensorflow/python/framework/ops.py", line 3392, in create_op
op_def=op_def)

File ".../site-packages/tensorflow/python/framework/ops.py", line 1749, in __init__
for i in range(num_outputs)]

File ".../site-packages/tensorflow/python/framework/c_api_util.py", line 135, in tf_output
ret = c_api.TF_Output()

File ".../python2.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 957, in __init__
this = _pywrap_tensorflow_internal.new_TF_Output()

我当前使用的版本:

Keras 2.1.2

Tensorflow 1.1.4

Numpy 1.13

Python 2.7

我是否需要升级或降级任何软件包的版本以使该错误消失?

0 个答案:

没有答案