16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | # define two sets of inputs inputA = Input(shape=(32,)) inputB = Input(shape=(128,)) # the first branch operates on the first input x = Dense(8, activation="relu")(inputA) x = Dense(4, activation="relu")(x) x = Model(inputs=inputA, outputs=x) # the second branch opreates on the second input y = Dense(64, activation="relu")(inputB) y = Dense(32, activation="relu")(y) y = Dense(4, activation="relu")(y) y = Model(inputs=inputB, outputs=y) # combine the output of the two branches combined = concatenate([x.output, y.output]) # apply a FC layer and then a regression prediction on the # combined outputs z = Dense(2, activation="relu")(combined) z = Dense(1, activation="linear")(z) # our model will accept the inputs of the two branches and # then output a single value model = Model(inputs=[x.input, y.input], outputs=z) |
Keras Functional API : https://keras.io/getting-started/functional-api-guide/
'Python Library > TensorFlow' 카테고리의 다른 글
Select TensorFlow operators to use in TensorFlow Lite (0) | 2019.08.21 |
---|---|
TensorFlow Lite and TensorFlow operator compatibility (0) | 2019.08.21 |
How To Convert Keras Model To .Pb format Example (0) | 2019.08.18 |
Colab Tensorboard API (0) | 2019.08.18 |
how to off Learning_phase for dropout and batch_norm when export .pb (0) | 2019.08.18 |