且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Keras自定义图层-AttributeError:"Tensor"对象没有属性"_keras_history"

更新时间:2023-12-01 21:14:58

错误消息看起来与以下问题非常相似: https: //***.com/a/45309816/1531463

The error message looks pretty much similar to this question: https://***.com/a/45309816/1531463

简而言之,我认为您需要换行:

In short, I think you need to wrap this line:

s_recon_layer = K.squeeze(recon_layer,2)

(或任何其他后端函数调用)进入Lambda层.

(or any other backend function calls) into a Lambda layer.

具体地说,

s_recon_layer = Lambda(lambda x: K.squeeze(x, 2))(recon_layer)