В вашем случае вы можете использовать комбинацию Lambda
слоев и merge
.
Так что это можно сделать с помощью чего-то вроде:
input = Input((6,))
# Split input to 3 streams
a = Lambda(lambda x: x[:, [0,4]], output_shape=(2,))(input)
b = Lambda(lambda x: x[:, 0:5], output_shape=(5,))(input)
c = Lambda(lambda x: x[:, 5], output_shape=(1,))(input)
# Build the hidden layer
hidden = merge([a, c, b], mode='concat')
# Split the hidden output to 2 streams
aa = Lambda(lambda x: x[:, 0:1], output_shape=(2,))(hidden)
d = Lambda(lambda x: x[:, 2], output_shape=(1,))(hidden)
# Build the output layer
output = merge([aa, d], mode='concat')
model = Model(input, output)