Created
July 17, 2019 20:09
-
-
Save tocom242242/a43363e2ef11bfc3c243372787819ce2 to your computer and use it in GitHub Desktop.
keras,divide middle layer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import keras | |
from keras.layers import Input, Dense, Lambda, concatenate | |
from keras.models import Model | |
from keras.utils import plot_model | |
inputs = Input(shape=(10,)) | |
x1_1 = Lambda(lambda x:x[:,:5],output_shape=(5,))(inputs) | |
x1_2 = Lambda(lambda x:x[:,5:],output_shape=(5,))(inputs) | |
x2 = concatenate([x1_1, x1_2]) | |
x3 = Dense(10)(x2) | |
model = Model(inputs=inputs,outputs=x3) | |
plot_model(model,"model.png") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment