AttributeError: 'NoneType' object has no attribute '_inbound_nodes' #11811

报错信息:AttributeError: 'NoneType' object has no attribute '_inbound_nodes' #11811

 

解决方案:

1. 原因:keras形成model的流程中必须要全部用开头为大写的层结构。例如:Concatenate(),所有keras.backend下面的功能性function都应该被封装成层结构。

The problem is that squeezed_cat_conv2 is not the output of a keras layer. You should put squeeze in a lambda layer. You can use keras layers on normal tensors, but if you want to make a Model all operations should be in keras layers.

 

The concatenate() is an operation which can be performed on tensors. The Concatenate() is a layer. Which should be used as such. So I was wrong before, you should use:
cat_conv = Concatenate(axis=3)([conv2d_out7,conv2d_out6,conv2d_out5])
Where you first construct the layer with Concatenate(axis=3) and then call it with the inputs of the layer.

 

2. 方法: 把tensor操作function封装在Lambda自定义层结构中。

 you have forgotten to wrap expand_dims inside a Lambda layer as well:

sent_input = Lambda(lambda x: expand_dims(x, axis=3))(sent_embed) # for channels
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值