C5W1A3. The lists contain a different number of elements

I’m getting the

AssertionError: Error in test. The lists contain a different number of elements

but the model summary on the next line seems to be outputting the correct number of params

Model: "functional_7"
__________________________________________________________________________________________________
Layer (type)                    Output Shape         Param #     Connected to                     
==================================================================================================
input_5 (InputLayer)            [(None, 30, 90)]     0                                            
__________________________________________________________________________________________________
tf_op_layer_strided_slice_120 ( [(None, 90)]         0           input_5[0][0]                    
__________________________________________________________________________________________________
tf_op_layer_Reshape_90 (TensorF [(None, 1, 90)]      0           tf_op_layer_strided_slice_120[0][
__________________________________________________________________________________________________
tf_op_layer_strided_slice_121 ( [(None, 90)]         0           input_5[0][0]                    
__________________________________________________________________________________________________
reshape (Reshape)               (None, 1, 90)        0           tf_op_layer_Reshape_90[0][0]     
                                                                 tf_op_layer_Reshape_91[0][0]     
                                                                 tf_op_layer_Reshape_92[0][0]     
                                                                 tf_op_layer_Reshape_93[0][0]     
                                                                 tf_op_layer_Reshape_94[0][0]     
                                                                 tf_op_layer_Reshape_95[0][0]     
                                                                 tf_op_layer_Reshape_96[0][0]     
                                                                 tf_op_layer_Reshape_97[0][0]     
                                                                 tf_op_layer_Reshape_98[0][0]     
                                                                 tf_op_layer_Reshape_99[0][0]     
                                                                 tf_op_layer_Reshape_100[0][0]    
                                                                 tf_op_layer_Reshape_101[0][0]    
                                                                 tf_op_layer_Reshape_102[0][0]    
                                                                 tf_op_layer_Reshape_103[0][0]    
                                                                 tf_op_layer_Reshape_104[0][0]    
                                                                 tf_op_layer_Reshape_105[0][0]    
                                                                 tf_op_layer_Reshape_106[0][0]    
                                                                 tf_op_layer_Reshape_107[0][0]    
                                                                 tf_op_layer_Reshape_108[0][0]    
                                                                 tf_op_layer_Reshape_109[0][0]    
                                                                 tf_op_layer_Reshape_110[0][0]    
                                                                 tf_op_layer_Reshape_111[0][0]    
                                                                 tf_op_layer_Reshape_112[0][0]    
                                                                 tf_op_layer_Reshape_113[0][0]    
                                                                 tf_op_layer_Reshape_114[0][0]    
                                                                 tf_op_layer_Reshape_115[0][0]    
                                                                 tf_op_layer_Reshape_116[0][0]    
                                                                 tf_op_layer_Reshape_117[0][0]    
                                                                 tf_op_layer_Reshape_118[0][0]    
                                                                 tf_op_layer_Reshape_119[0][0]    
__________________________________________________________________________________________________
a0 (InputLayer)                 [(None, 64)]         0                                            
__________________________________________________________________________________________________
c0 (InputLayer)                 [(None, 64)]         0                                            
__________________________________________________________________________________________________
tf_op_layer_Reshape_91 (TensorF [(None, 1, 90)]      0           tf_op_layer_strided_slice_121[0][
__________________________________________________________________________________________________
tf_op_layer_strided_slice_122 ( [(None, 90)]         0           input_5[0][0]                    
__________________________________________________________________________________________________
lstm (LSTM)                     [(None, 64), (None,  39680       reshape[120][0]                  
                                                                 a0[0][0]                         
                                                                 c0[0][0]                         
                                                                 reshape[121][0]                  
                                                                 lstm[120][1]                     
                                                                 lstm[120][2]                     
                                                                 reshape[122][0]                  
                                                                 lstm[121][1]                     
                                                                 lstm[121][2]                     
                                                                 reshape[123][0]                  
                                                                 lstm[122][1]                     
                                                                 lstm[122][2]                     
                                                                 reshape[124][0]                  
                                                                 lstm[123][1]                     
                                                                 lstm[123][2]                     
                                                                 reshape[125][0]                  
                                                                 lstm[124][1]                     
                                                                 lstm[124][2]                     
                                                                 reshape[126][0]                  
                                                                 lstm[125][1]                     
                                                                 lstm[125][2]                     
                                                                 reshape[127][0]                  
                                                                 lstm[126][1]                     
                                                                 lstm[126][2]                     
                                                                 reshape[128][0]                  
                                                                 lstm[127][1]                     
                                                                 lstm[127][2]                     
                                                                 reshape[129][0]                  
                                                                 lstm[128][1]                     
                                                                 lstm[128][2]                     
                                                                 reshape[130][0]                  
                                                                 lstm[129][1]                     
                                                                 lstm[129][2]                     
                                                                 reshape[131][0]                  
                                                                 lstm[130][1]                     
                                                                 lstm[130][2]                     
                                                                 reshape[132][0]                  
                                                                 lstm[131][1]                     
                                                                 lstm[131][2]                     
                                                                 reshape[133][0]                  
                                                                 lstm[132][1]                     
                                                                 lstm[132][2]                     
                                                                 reshape[134][0]                  
                                                                 lstm[133][1]                     
                                                                 lstm[133][2]                     
                                                                 reshape[135][0]                  
                                                                 lstm[134][1]                     
                                                                 lstm[134][2]                     
                                                                 reshape[136][0]                  
                                                                 lstm[135][1]                     
                                                                 lstm[135][2]                     
                                                                 reshape[137][0]                  
                                                                 lstm[136][1]                     
                                                                 lstm[136][2]                     
                                                                 reshape[138][0]                  
                                                                 lstm[137][1]                     
                                                                 lstm[137][2]                     
                                                                 reshape[139][0]                  
                                                                 lstm[138][1]                     
                                                                 lstm[138][2]                     
                                                                 reshape[140][0]                  
                                                                 lstm[139][1]                     
                                                                 lstm[139][2]                     
                                                                 reshape[141][0]                  
                                                                 lstm[140][1]                     
                                                                 lstm[140][2]                     
                                                                 reshape[142][0]                  
                                                                 lstm[141][1]                     
                                                                 lstm[141][2]                     
                                                                 reshape[143][0]                  
                                                                 lstm[142][1]                     
                                                                 lstm[142][2]                     
                                                                 reshape[144][0]                  
                                                                 lstm[143][1]                     
                                                                 lstm[143][2]                     
                                                                 reshape[145][0]                  
                                                                 lstm[144][1]                     
                                                                 lstm[144][2]                     
                                                                 reshape[146][0]                  
                                                                 lstm[145][1]                     
                                                                 lstm[145][2]                     
                                                                 reshape[147][0]                  
                                                                 lstm[146][1]                     
                                                                 lstm[146][2]                     
                                                                 reshape[148][0]                  
                                                                 lstm[147][1]                     
                                                                 lstm[147][2]                     
                                                                 reshape[149][0]                  
                                                                 lstm[148][1]                     
                                                                 lstm[148][2]                     
__________________________________________________________________________________________________
tf_op_layer_Reshape_92 (TensorF [(None, 1, 90)]      0           tf_op_layer_strided_slice_122[0][
__________________________________________________________________________________________________
tf_op_layer_strided_slice_123 ( [(None, 90)]         0           input_5[0][0]                    
__________________________________________________________________________________________________
tf_op_layer_Reshape_93 (TensorF [(None, 1, 90)]      0           tf_op_layer_strided_slice_123[0][
__________________________________________________________________________________________________
tf_op_layer_strided_slice_124 ( [(None, 90)]         0           input_5[0][0]                    
__________________________________________________________________________________________________
tf_op_layer_Reshape_94 (TensorF [(None, 1, 90)]      0           tf_op_layer_strided_slice_124[0][
__________________________________________________________________________________________________
tf_op_layer_strided_slice_125 ( [(None, 90)]         0           input_5[0][0]                    
__________________________________________________________________________________________________
tf_op_layer_Reshape_95 (TensorF [(None, 1, 90)]      0           tf_op_layer_strided_slice_125[0][
__________________________________________________________________________________________________
tf_op_layer_strided_slice_126 ( [(None, 90)]         0           input_5[0][0]                    
__________________________________________________________________________________________________
tf_op_layer_Reshape_96 (TensorF [(None, 1, 90)]      0           tf_op_layer_strided_slice_126[0][
__________________________________________________________________________________________________
tf_op_layer_strided_slice_127 ( [(None, 90)]         0           input_5[0][0]                    
__________________________________________________________________________________________________
tf_op_layer_Reshape_97 (TensorF [(None, 1, 90)]      0           tf_op_layer_strided_slice_127[0][
__________________________________________________________________________________________________
tf_op_layer_strided_slice_128 ( [(None, 90)]         0           input_5[0][0]                    
__________________________________________________________________________________________________
tf_op_layer_Reshape_98 (TensorF [(None, 1, 90)]      0           tf_op_layer_strided_slice_128[0][
__________________________________________________________________________________________________
tf_op_layer_strided_slice_129 ( [(None, 90)]         0           input_5[0][0]                    
__________________________________________________________________________________________________
tf_op_layer_Reshape_99 (TensorF [(None, 1, 90)]      0           tf_op_layer_strided_slice_129[0][
__________________________________________________________________________________________________
tf_op_layer_strided_slice_130 ( [(None, 90)]         0           input_5[0][0]                    
__________________________________________________________________________________________________
tf_op_layer_Reshape_100 (Tensor [(None, 1, 90)]      0           tf_op_layer_strided_slice_130[0][
__________________________________________________________________________________________________
tf_op_layer_strided_slice_131 ( [(None, 90)]         0           input_5[0][0]                    
__________________________________________________________________________________________________
tf_op_layer_Reshape_101 (Tensor [(None, 1, 90)]      0           tf_op_layer_strided_slice_131[0][
__________________________________________________________________________________________________
tf_op_layer_strided_slice_132 ( [(None, 90)]         0           input_5[0][0]                    
__________________________________________________________________________________________________
tf_op_layer_Reshape_102 (Tensor [(None, 1, 90)]      0           tf_op_layer_strided_slice_132[0][
__________________________________________________________________________________________________
tf_op_layer_strided_slice_133 ( [(None, 90)]         0           input_5[0][0]                    
__________________________________________________________________________________________________
tf_op_layer_Reshape_103 (Tensor [(None, 1, 90)]      0           tf_op_layer_strided_slice_133[0][
__________________________________________________________________________________________________
tf_op_layer_strided_slice_134 ( [(None, 90)]         0           input_5[0][0]                    
__________________________________________________________________________________________________
tf_op_layer_Reshape_104 (Tensor [(None, 1, 90)]      0           tf_op_layer_strided_slice_134[0][
__________________________________________________________________________________________________
tf_op_layer_strided_slice_135 ( [(None, 90)]         0           input_5[0][0]                    
__________________________________________________________________________________________________
tf_op_layer_Reshape_105 (Tensor [(None, 1, 90)]      0           tf_op_layer_strided_slice_135[0][
__________________________________________________________________________________________________
tf_op_layer_strided_slice_136 ( [(None, 90)]         0           input_5[0][0]                    
__________________________________________________________________________________________________
tf_op_layer_Reshape_106 (Tensor [(None, 1, 90)]      0           tf_op_layer_strided_slice_136[0][
__________________________________________________________________________________________________
tf_op_layer_strided_slice_137 ( [(None, 90)]         0           input_5[0][0]                    
__________________________________________________________________________________________________
tf_op_layer_Reshape_107 (Tensor [(None, 1, 90)]      0           tf_op_layer_strided_slice_137[0][
__________________________________________________________________________________________________
tf_op_layer_strided_slice_138 ( [(None, 90)]         0           input_5[0][0]                    
__________________________________________________________________________________________________
tf_op_layer_Reshape_108 (Tensor [(None, 1, 90)]      0           tf_op_layer_strided_slice_138[0][
__________________________________________________________________________________________________
tf_op_layer_strided_slice_139 ( [(None, 90)]         0           input_5[0][0]                    
__________________________________________________________________________________________________
tf_op_layer_Reshape_109 (Tensor [(None, 1, 90)]      0           tf_op_layer_strided_slice_139[0][
__________________________________________________________________________________________________
tf_op_layer_strided_slice_140 ( [(None, 90)]         0           input_5[0][0]                    
__________________________________________________________________________________________________
tf_op_layer_Reshape_110 (Tensor [(None, 1, 90)]      0           tf_op_layer_strided_slice_140[0][
__________________________________________________________________________________________________
tf_op_layer_strided_slice_141 ( [(None, 90)]         0           input_5[0][0]                    
__________________________________________________________________________________________________
tf_op_layer_Reshape_111 (Tensor [(None, 1, 90)]      0           tf_op_layer_strided_slice_141[0][
__________________________________________________________________________________________________
tf_op_layer_strided_slice_142 ( [(None, 90)]         0           input_5[0][0]                    
__________________________________________________________________________________________________
tf_op_layer_Reshape_112 (Tensor [(None, 1, 90)]      0           tf_op_layer_strided_slice_142[0][
__________________________________________________________________________________________________
tf_op_layer_strided_slice_143 ( [(None, 90)]         0           input_5[0][0]                    
__________________________________________________________________________________________________
tf_op_layer_Reshape_113 (Tensor [(None, 1, 90)]      0           tf_op_layer_strided_slice_143[0][
__________________________________________________________________________________________________
tf_op_layer_strided_slice_144 ( [(None, 90)]         0           input_5[0][0]                    
__________________________________________________________________________________________________
tf_op_layer_Reshape_114 (Tensor [(None, 1, 90)]      0           tf_op_layer_strided_slice_144[0][
__________________________________________________________________________________________________
tf_op_layer_strided_slice_145 ( [(None, 90)]         0           input_5[0][0]                    
__________________________________________________________________________________________________
tf_op_layer_Reshape_115 (Tensor [(None, 1, 90)]      0           tf_op_layer_strided_slice_145[0][
__________________________________________________________________________________________________
tf_op_layer_strided_slice_146 ( [(None, 90)]         0           input_5[0][0]                    
__________________________________________________________________________________________________
tf_op_layer_Reshape_116 (Tensor [(None, 1, 90)]      0           tf_op_layer_strided_slice_146[0][
__________________________________________________________________________________________________
tf_op_layer_strided_slice_147 ( [(None, 90)]         0           input_5[0][0]                    
__________________________________________________________________________________________________
tf_op_layer_Reshape_117 (Tensor [(None, 1, 90)]      0           tf_op_layer_strided_slice_147[0][
__________________________________________________________________________________________________
tf_op_layer_strided_slice_148 ( [(None, 90)]         0           input_5[0][0]                    
__________________________________________________________________________________________________
tf_op_layer_Reshape_118 (Tensor [(None, 1, 90)]      0           tf_op_layer_strided_slice_148[0][
__________________________________________________________________________________________________
tf_op_layer_strided_slice_149 ( [(None, 90)]         0           input_5[0][0]                    
__________________________________________________________________________________________________
tf_op_layer_Reshape_119 (Tensor [(None, 1, 90)]      0           tf_op_layer_strided_slice_149[0][
__________________________________________________________________________________________________
dense (Dense)                   (None, 90)           5850        lstm[120][1]                     
                                                                 lstm[121][1]                     
                                                                 lstm[122][1]                     
                                                                 lstm[123][1]                     
                                                                 lstm[124][1]                     
                                                                 lstm[125][1]                     
                                                                 lstm[126][1]                     
                                                                 lstm[127][1]                     
                                                                 lstm[128][1]                     
                                                                 lstm[129][1]                     
                                                                 lstm[130][1]                     
                                                                 lstm[131][1]                     
                                                                 lstm[132][1]                     
                                                                 lstm[133][1]                     
                                                                 lstm[134][1]                     
                                                                 lstm[135][1]                     
                                                                 lstm[136][1]                     
                                                                 lstm[137][1]                     
                                                                 lstm[138][1]                     
                                                                 lstm[139][1]                     
                                                                 lstm[140][1]                     
                                                                 lstm[141][1]                     
                                                                 lstm[142][1]                     
                                                                 lstm[143][1]                     
                                                                 lstm[144][1]                     
                                                                 lstm[145][1]                     
                                                                 lstm[146][1]                     
                                                                 lstm[147][1]                     
                                                                 lstm[148][1]                     
                                                                 lstm[149][1]                     
==================================================================================================
Total params: 45,530
Trainable params: 45,530
Non-trainable params: 0

I poured over the instructions, but I can’t seem to find anything wrong with my code. I suspect it has to do with Step 2A, where I was getting shape (None, 90), which would not fit into the reshaper layer (summary model seems to want (None, 1, 90)), so I used tf.reshape on it. Maybe that’s the issue?

Hello @AlgorithmicAscension,

I can only share a way for you to check your answer. First, I assume you are on the exercise 1 (but the same will apply to the exercise 2 too).

First, the code that triggered that error should be:
image

and by examining the code for comparator (which is also available to you), we know it failed the following len check:

output is being tested. The first step you can do is to print out output and djmodel_out and compare them to find out the difference. You find the difference, understand the cause, then get rid of it.

Btw, next time, please share the whole error traceback :wink:

Good luck!
Raymond

1 Like

Thank you! It turns out I the shape was indeed the problem. I was navigating a different error, and the instruction of the shape of X had thrown me off. I removed the tf.reshape, and all the tests passed. Thank you for the tip :slight_smile:

It’s great!! :smiley: