How to use tile function in Keras?

前端 未结 1 1933
迷失自我
迷失自我 2020-12-21 20:50

I want to build a neural network with Keras,but I got a error: AttributeError: \'NoneType\' object has no attribute \'_inbound_nodes\',and this is my example co

相关标签:
1条回答
  • 2020-12-21 21:20

    This error occurs because keras.backend.tile is a function and not a layer, making tiled_emb a tensor. The error is then generated when trying to construct the network and encountering just a tensor where it expects a layer (so the attr _inbound_nodes is not defined).

    You can turn any function into a layer by using the keras.layers.lambda layer, eg:

    tiled_emb = Lambda(keras.backend.tile, arguments={'n':(-1, 64, 64, 1)})(text_emb)
    
    0 讨论(0)
提交回复
热议问题