farizrahman4u / recurrentshop

Framework for building complex recurrent neural networks with Keras
MIT License
765 stars 218 forks source link

AssertionError: Required 2 inputs, received 3. #105

Open kaeflint opened 6 years ago

kaeflint commented 6 years ago

I was trying out your library today as shown below:

vocab_len=1000
hidden_units = 150
getShape= Lambda(lambda a: a,output_shape=(2*hidden_units,))
in_x = Input(shape=(None,))
in_y = Input(shape=(None,))

embedding = Embedding(1000,100)
x_emb = embedding(in_x)
encoder = RecurrentSequential(readout=True,return_states=True,
                                  return_sequences=True,state_sync=True,unroll=False)
encoder.add(Dropout(0.1,input_shape=K.int_shape(x_emb)))

encoder.add(LSTMCell(hidden_units))
encoder.add(Dropout(0.1))
encoded_seq = encoder(inputs=x_emb)

But I encountered the error below:

AssertionError Traceback (most recent call last)

in () ----> 1 encoded_seq = encoder(inputs=x_emb) C:\ProgramData\Anaconda3\envs\py3\lib\site-packages\recurrentshop-1.0.0-py3.6.egg\recurrentshop\engine.py in __call__(self, inputs, initial_state, initial_readout, ground_truth, **kwargs) 474 ground_truth = self._get_optional_input_placeholder('ground_truth') 475 inputs.append(ground_truth) --> 476 assert len(inputs) == req_num_inputs, "Required " + str(req_num_inputs) + " inputs, received " + str(len(inputs)) + "." 477 with K.name_scope(self.name): 478 if not self.built: AssertionError: Required 2 inputs, received 3. I tried to follow your example. I am using keras 2.2.0 with tensorflow backend.