import numpy
import numpy as np
from keras.models import Model
from keras.layers import Dense, Merge, concatenate, Input
from keras.layers import LSTM
from keras.utils import np_utils
inp1 = Input(shape=(10,20))
inp2 = Input(shape=(10,32))
cc1 = concatenate([inp1, inp2],axis=2) # Merge column, same row
output = Dense(30, activation='relu')(cc1)
model = Model(inputs=[inp1, inp2], outputs=output)
model.summary()
__________________________________________________________________________________________________ Layer (type) Output Shape Param # Connected to ================================================================================================== input_40 (InputLayer) (None, 10, 20) 0 __________________________________________________________________________________________________ input_41 (InputLayer) (None, 10, 32) 0 __________________________________________________________________________________________________ concatenate_21 (Concatenate) (None, 10, 52) 0 input_40[0][0] input_41[0][0] __________________________________________________________________________________________________ dense_12 (Dense) (None, 10, 30) 1590 concatenate_21[0][0] ================================================================================================== Total params: 1,590 Trainable params: 1,590 Non-trainable params: 0 __________________________________________________________________________________________________
inp1 = Input(shape=(20,10))
inp2 = Input(shape=(32,10))
cc1 = concatenate([inp1, inp2],axis=1) # Merge row, same column
output = Dense(30, activation='relu')(cc1)
model = Model(inputs=[inp1, inp2], outputs=output)
model.summary()
__________________________________________________________________________________________________ Layer (type) Output Shape Param # Connected to ================================================================================================== input_42 (InputLayer) (None, 20, 10) 0 __________________________________________________________________________________________________ input_43 (InputLayer) (None, 32, 10) 0 __________________________________________________________________________________________________ concatenate_22 (Concatenate) (None, 52, 10) 0 input_42[0][0] input_43[0][0] __________________________________________________________________________________________________ dense_13 (Dense) (None, 52, 30) 330 concatenate_22[0][0] ================================================================================================== Total params: 330 Trainable params: 330 Non-trainable params: 0 __________________________________________________________________________________________________
inp1 = Input(shape=(10,10))
inp2 = Input(shape=(10,10))
cc1 = concatenate([inp1, inp2],axis=0) # Merge data must same row column
output = Dense(30, activation='relu')(cc1)
model = Model(inputs=[inp1, inp2], outputs=output)
model.summary()
__________________________________________________________________________________________________ Layer (type) Output Shape Param # Connected to ================================================================================================== input_44 (InputLayer) (None, 10, 10) 0 __________________________________________________________________________________________________ input_45 (InputLayer) (None, 10, 10) 0 __________________________________________________________________________________________________ concatenate_23 (Concatenate) (None, 10, 10) 0 input_44[0][0] input_45[0][0] __________________________________________________________________________________________________ dense_14 (Dense) (None, 10, 30) 330 concatenate_23[0][0] ================================================================================================== Total params: 330 Trainable params: 330 Non-trainable params: 0 __________________________________________________________________________________________________