简体   繁体   中英

AttributeError: 'InputLayer' object has no attribute 'inbound_nodes'

运行此脚本时出现以下错误: https : //pastebin.com/X7146Ury

AttributeError: 'InputLayer' object has no attribute 'inbound_nodes'

In the latest version of Keras this was renamed to _inbound_nodes (note the added underscore). The version of coremltools you're using does not appear to be compatible with that Keras version yet.

However, the latest version on GitHub does appear to use the new _inbound_nodes name. I suggest you install that, using:

pip install -U git+https://github.com/apple/coremltools.git

I was trying to write a custom layer, the problem was the class which I was subclassing, instead of from tensorflow.keras.layers import Layer , I used

from Keras import layers
class layerName(layers.Layer):
    #impelementation

and it worked.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM