所以我想在我的 keras-nn 中将多个层合并为 1。不同之处在于,我不想像在Add()-layer 中那样组合它们,但我想将具有不同形状但尺寸相同的多个层组合成一个更大的层,其形状是输入层的总和。这是我非常粗略的绘制结构(点代表一个节点):这是一些我想象的代码:[IN]input_1 = Input(shape=(4,))input_2 = Input(shape=(6,))combined = Combined()([input_1, input_2])print(input_1.shape, input_2.shape, input_3.shape)[OUT](4,) (6,) (10,)keras中可能已经有一个具有该功能的Layer,但是我浏览了互联网一段时间,找不到任何解决此问题的方法
1 回答
梵蒂冈之花
TA贡献1900条经验 获得超5个赞
你想要的是Concatenate图层:
input_1 = Input(shape=(4,))
input_2 = Input(shape=(6,))
combined = Concatenate()([input_1, input_2])
print(input_1.shape, input_2.shape, combined.shape)
这输出:
(?, 4) (?, 6) (?, 10)
添加回答
举报
0/150
提交
取消
