DeepLearning / / 2022. 10. 31. 10:33

DeepLearning - 신경망 결합 concatenate

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()

 

  • 네이버 블로그 공유
  • 네이버 밴드 공유
  • 페이스북 공유
  • 카카오스토리 공유