Keras:InvalidArgumentError:形状不兼容:[96]与[128]

时间:2020-05-11 13:30:21

标签: python-3.x keras deep-learning autoencoder

我正在尝试使用this页来构建变体自动编码器。这是我的模型的摘要:

Model: "model_44"
__________________________________________________________________________________________________
Layer (type)                    Output Shape         Param #     Connected to                     
==================================================================================================
input_32 (InputLayer)           (None, 784)          0                                            
__________________________________________________________________________________________________
dense_70 (Dense)                (None, 32)           25120       input_32[0][0]                   
__________________________________________________________________________________________________
dense_71 (Dense)                (None, 2)            66          dense_70[0][0]                   
__________________________________________________________________________________________________
dense_72 (Dense)                (None, 2)            66          dense_70[0][0]                   
__________________________________________________________________________________________________
lambda_16 (Lambda)              (None, 2)            0           dense_71[0][0]                   
                                                                 dense_72[0][0]                   
__________________________________________________________________________________________________
dense_73 (Dense)                (None, 32)           96          lambda_16[0][0]                  
__________________________________________________________________________________________________
dense_74 (Dense)                (None, 784)          25872       dense_73[0][0]                   
==================================================================================================
Total params: 51,220
Trainable params: 51,220
Non-trainable params: 0

但是,每当我开始训练时,在第一个时期,我都会遇到以下错误:

InvalidArgumentError:不兼容的形状:[96]与[128] [[node 渐变_8 /损失_17 /密集_74_损失/ vae_loss / weighted_loss / mul_grad / Mul_1 (定义为 /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:3009) ]] [操作:__ inference_keras_scratch_graph_49801]

函数调用堆栈:keras_scratch_graph

我的代码与链接完全相同。你能帮我吗?

0 个答案:

没有答案