Programming Assignment 3 of C5 W1 of DLS: The first argument to `Layer.call` must always be passed

Greetings!
I am getting the following error while trying to complete Improvise_a_Jazz_Solo_with_an_LSTM_Network_v4.
I am unable to understand how to address this error. Any imputs would be greatly appreciated.

ValueError                                Traceback (most recent call last)
<ipython-input-65-d2753e0c7a2d> in <module>
----> 1 model = djmodel(Tx=30, LSTM_cell=LSTM_cell, densor=densor, reshaper=reshaper)

<ipython-input-64-3aa02d56a20f> in djmodel(Tx, LSTM_cell, densor, reshaper)
     49 
     50         # Step 2.D: Apply densor to the hidden state output of LSTM_Cell
---> 51         out = densor(n_values=n_values, activation='softmax')
     52         print(out)
     53         # Step 2.E: add the output to "outputs"

/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py in __call__(self, *args, **kwargs)
    914     #   not to any other argument.
    915     # - setting the SavedModel saving spec.
--> 916     inputs, args, kwargs = self._split_out_first_arg(args, kwargs)
    917     input_list = nest.flatten(inputs)
    918 

/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py in _split_out_first_arg(self, args, kwargs)
   2978     else:
   2979       raise ValueError(
-> 2980           'The first argument to `Layer.call` must always be passed.')
   2981     return inputs, args, kwargs
   2982 

ValueError: The first argument to `Layer.call` must always be passed.

In Step 2.D, you need to pass the hidden layer output of Step 2.C.

You don’t need to pass the number of values or the activation type - those are already specified in the cell that defines the densor() layer.

1 Like

thank you for your quick response!
Please see the attached image and see the definition of densor. Is that not right? sorry, unable to understand.

The code for densor = Dense(…) is correct. It’s provided code, you don’t need to modify it.

The issue is that you’re not using densor(…) correctly in Step 2.D.