DeepLearning
DeepLearning - 신경망 결합 concatenate
Hoon[]
2022. 10. 31. 10:33
inputA = Input(shape=(2,))
x = Dense(4,activation='relu')(inputA)
x = Dense(2, activation='relu')(x)
x = Model(inputs=inputA,outputs=x)
inputB = Input(shape=(4,))
y = Dense(4, activation='relu',)(inputB)
y = Dense(2, activation='relu')(y)
y = Dense(2, activation='relu')(y)
y = Model(inputs=inputB,outputs=y)
from tensorflow.keras.utils import plot_model
x.summary()
y.summary()
#inputA , inputB 합치기 concat 이용
import tensorflow as tf
result = concatenate([x.output,y.output])
z = Dense(2,activation='relu')(result)
z = Dense(1,activation='linear')(z)
model = Model(inputs=[x.input, y.input], outputs=z)
model.summary()