keras-team / keras

Deep Learning for humans
http://keras.io/
Apache License 2.0
61.97k stars 19.46k forks source link

TypeError: concatenate() missing 1 required positional argument: 'inputs' #13367

Closed Sanbot-okk closed 3 years ago

Sanbot-okk commented 5 years ago

This is my code, and I do not know how to resolve this error as am very new to Keras

from keras.models import Model, Sequential from keras.layers import LSTM, Dense, concatenate

import numpy as np

input_size = 70 output_size = 65 hidden_units = 512

LSTM_a = Sequential() LSTM_a.add(LSTM(hidden_units,return_sequences=True, input_shape=(None, input_size)))

BLSTM_a = Sequential() BLSTM_a.add(Bidirectional(LSTM(hidden_units,return_sequences=True, input_shape=(None, input_size))))

merged_output = concatenate()([LSTM_a,BLSTM_a],axis=1)

LSTM_b = Sequential() LSTM_b.add(merged_output) LSTM_b.add(Dense(output_size, activation='softmax'))

LSTM_b.compile(loss='categorical_crossentropy', optimizer='adam')

AndreasPangerl commented 5 years ago

Hi,

maybe you have to put input_size as first argument of input_shape?

Best Regards, Andreas

Sanbot-okk commented 5 years ago

Hi,

maybe you have to put input_size as first argument of input_shape?

Best Regards, Andreas

But I need a the model to train with examples of different lengths, hence I cannot assign a value where I have used None. Even then, I tried with random numbers for input_shape and that doesn't seem to stop the error from ocurring.