I created the following network. The idea is to combine the outputs of the left
and right
, then send to a LSTM model.
EMBED_DIM = 4
look_back = 6
feature_num = 2
ENCODE_DIM = 676
left = Sequential()
left.add(Dense(EMBED_DIM,input_shape=(ENCODE_DIM,)))
left.add(RepeatVector(look_back))
left.add(Reshape((look_back,EMBED_DIM)))
right = Sequential()
right.add(Lambda(lambda x: x,input_shape=(look_back,feature_num)))
# create and fit the LSTM network
model = Sequential()
model.add(Concatenate([left, right], axis = 2,input_shape=(look_back, EMBED_DIM + feature_num) ))
model.add(LSTM(8, input_shape=(look_back,feature_num + EMBED_DIM)))
model.add(Dense(2))
model.compile(loss='mean_squared_error', optimizer='adam')
I am trying to concatenate the output from left and right, then send the new tensor to the LSTM model.
However, I got the following error:
TypeError Traceback (most recent call last)
<ipython-input-156-275f5597cdad> in <module>()
---> 37 model.add(Concatenate([left, right], axis = 2,input_shape=(look_back, EMBED_DIM + feature_num) ))
38 model.add(LSTM(8, input_shape=(look_back,feature_num + EMBED_DIM)))
39
TypeError: __init__() got multiple values for argument 'axis'
Any idea what I did wrong? Can I add a Concatenate
layer as the first layer of a model? Thanks!