在Keras中,一层的输出与下一层的输入不匹配

时间:2019-12-06 05:33:59

标签: python tensorflow keras

在我的Keras模型的一部分中,我添加了一个平均层,然后添加了relu激活层作为下一层。

A = Average(name='average')([Y12,Y22])
A2 = Activation('relu',name='rectified')(A)

然后我检查了A层的输出和A2层的输入。

model_nr= Model(inputs=model.input,
                    outputs=[model.get_layer('average').output,
                             model.get_layer('rectified').input])

在这里,蓝色的是“平均值”层的输出,红色的是“整流”层的输入。 Here, the blue one is the output of 'average' and the red one is the input to layer 'rectified'.

为什么会这样?我也检查了线性激活,这会导致垃圾。 The result for using linear activation.

好像一层的输出根本没有传递到下一层。这是Keras中的错误,还是我做错了什么?

0 个答案:

没有答案