Link to assignment: Coursera | Online Courses & Credentials From Top Educators. Join for Free | Coursera
I need help with this assignment and I have already looked at previous posts and tried their suggestions.
In the unit test of after the definition of djmodel, I am getting an error which I think is due to the fact that the test does not expect the slice operation to appear as a layer in the model summary. I initially implemented the slice, as suggested in the notebook, using the python array index syntax, but I have also used tf.slice and tf.strided_slice and they also didn’t solve it. I have also played with changing method input and output params in all layers and it also didn’t help…
The error and the model summary are below:
Test failed at index 2
Expected value
['TensorFlowOpLayer', [(None, 90)], 0]
does not match the input value:
['Reshape', (None, 1, 90), 0]
Here is the output of the model summary:
Model: "model_1"
__________________________________________________________________________________________________
Layer (type) Output Shape Param # Connected to
==================================================================================================
input_2 (InputLayer) [(None, 30, 90)] 0
__________________________________________________________________________________________________
tf_op_layer_strided_slice_30 (T [(None, 90)] 0 input_2[0][0]
__________________________________________________________________________________________________
tf_op_layer_strided_slice_31 (T [(None, 90)] 0 input_2[0][0]
__________________________________________________________________________________________________
tf_op_layer_strided_slice_32 (T [(None, 90)] 0 input_2[0][0]
__________________________________________________________________________________________________
tf_op_layer_strided_slice_33 (T [(None, 90)] 0 input_2[0][0]
__________________________________________________________________________________________________
tf_op_layer_strided_slice_34 (T [(None, 90)] 0 input_2[0][0]
__________________________________________________________________________________________________
tf_op_layer_strided_slice_35 (T [(None, 90)] 0 input_2[0][0]
__________________________________________________________________________________________________
tf_op_layer_strided_slice_36 (T [(None, 90)] 0 input_2[0][0]
__________________________________________________________________________________________________
tf_op_layer_strided_slice_37 (T [(None, 90)] 0 input_2[0][0]
__________________________________________________________________________________________________
tf_op_layer_strided_slice_38 (T [(None, 90)] 0 input_2[0][0]
__________________________________________________________________________________________________
tf_op_layer_strided_slice_39 (T [(None, 90)] 0 input_2[0][0]
__________________________________________________________________________________________________
tf_op_layer_strided_slice_40 (T [(None, 90)] 0 input_2[0][0]
__________________________________________________________________________________________________
tf_op_layer_strided_slice_41 (T [(None, 90)] 0 input_2[0][0]
__________________________________________________________________________________________________
tf_op_layer_strided_slice_42 (T [(None, 90)] 0 input_2[0][0]
__________________________________________________________________________________________________
tf_op_layer_strided_slice_43 (T [(None, 90)] 0 input_2[0][0]
__________________________________________________________________________________________________
tf_op_layer_strided_slice_44 (T [(None, 90)] 0 input_2[0][0]
__________________________________________________________________________________________________
tf_op_layer_strided_slice_45 (T [(None, 90)] 0 input_2[0][0]
__________________________________________________________________________________________________
tf_op_layer_strided_slice_46 (T [(None, 90)] 0 input_2[0][0]
__________________________________________________________________________________________________
tf_op_layer_strided_slice_47 (T [(None, 90)] 0 input_2[0][0]
__________________________________________________________________________________________________
tf_op_layer_strided_slice_48 (T [(None, 90)] 0 input_2[0][0]
__________________________________________________________________________________________________
tf_op_layer_strided_slice_49 (T [(None, 90)] 0 input_2[0][0]
__________________________________________________________________________________________________
tf_op_layer_strided_slice_50 (T [(None, 90)] 0 input_2[0][0]
__________________________________________________________________________________________________
tf_op_layer_strided_slice_51 (T [(None, 90)] 0 input_2[0][0]
__________________________________________________________________________________________________
tf_op_layer_strided_slice_52 (T [(None, 90)] 0 input_2[0][0]
__________________________________________________________________________________________________
tf_op_layer_strided_slice_53 (T [(None, 90)] 0 input_2[0][0]
__________________________________________________________________________________________________
tf_op_layer_strided_slice_54 (T [(None, 90)] 0 input_2[0][0]
__________________________________________________________________________________________________
tf_op_layer_strided_slice_55 (T [(None, 90)] 0 input_2[0][0]
__________________________________________________________________________________________________
tf_op_layer_strided_slice_56 (T [(None, 90)] 0 input_2[0][0]
__________________________________________________________________________________________________
tf_op_layer_strided_slice_57 (T [(None, 90)] 0 input_2[0][0]
__________________________________________________________________________________________________
tf_op_layer_strided_slice_58 (T [(None, 90)] 0 input_2[0][0]
__________________________________________________________________________________________________
tf_op_layer_strided_slice_59 (T [(None, 90)] 0 input_2[0][0]
__________________________________________________________________________________________________
reshape (Reshape) (None, 1, 90) 0 tf_op_layer_strided_slice_30[0][0
tf_op_layer_strided_slice_31[0][0
tf_op_layer_strided_slice_32[0][0
tf_op_layer_strided_slice_33[0][0
tf_op_layer_strided_slice_34[0][0
tf_op_layer_strided_slice_35[0][0
tf_op_layer_strided_slice_36[0][0
tf_op_layer_strided_slice_37[0][0
tf_op_layer_strided_slice_38[0][0
tf_op_layer_strided_slice_39[0][0
tf_op_layer_strided_slice_40[0][0
tf_op_layer_strided_slice_41[0][0
tf_op_layer_strided_slice_42[0][0
tf_op_layer_strided_slice_43[0][0
tf_op_layer_strided_slice_44[0][0
tf_op_layer_strided_slice_45[0][0
tf_op_layer_strided_slice_46[0][0
tf_op_layer_strided_slice_47[0][0
tf_op_layer_strided_slice_48[0][0
tf_op_layer_strided_slice_49[0][0
tf_op_layer_strided_slice_50[0][0
tf_op_layer_strided_slice_51[0][0
tf_op_layer_strided_slice_52[0][0
tf_op_layer_strided_slice_53[0][0
tf_op_layer_strided_slice_54[0][0
tf_op_layer_strided_slice_55[0][0
tf_op_layer_strided_slice_56[0][0
tf_op_layer_strided_slice_57[0][0
tf_op_layer_strided_slice_58[0][0
tf_op_layer_strided_slice_59[0][0
__________________________________________________________________________________________________
a0 (InputLayer) [(None, 64)] 0
__________________________________________________________________________________________________
c0 (InputLayer) [(None, 64)] 0
__________________________________________________________________________________________________
lstm (LSTM) [(None, 64), (None, 39680 reshape[30][0]
a0[0][0]
c0[0][0]
reshape[31][0]
a0[0][0]
c0[0][0]
reshape[32][0]
a0[0][0]
c0[0][0]
reshape[33][0]
a0[0][0]
c0[0][0]
reshape[34][0]
a0[0][0]
c0[0][0]
reshape[35][0]
a0[0][0]
c0[0][0]
reshape[36][0]
a0[0][0]
c0[0][0]
reshape[37][0]
a0[0][0]
c0[0][0]
reshape[38][0]
a0[0][0]
c0[0][0]
reshape[39][0]
a0[0][0]
c0[0][0]
reshape[40][0]
a0[0][0]
c0[0][0]
reshape[41][0]
a0[0][0]
c0[0][0]
reshape[42][0]
a0[0][0]
c0[0][0]
reshape[43][0]
a0[0][0]
c0[0][0]
reshape[44][0]
a0[0][0]
c0[0][0]
reshape[45][0]
a0[0][0]
c0[0][0]
reshape[46][0]
a0[0][0]
c0[0][0]
reshape[47][0]
a0[0][0]
c0[0][0]
reshape[48][0]
a0[0][0]
c0[0][0]
reshape[49][0]
a0[0][0]
c0[0][0]
reshape[50][0]
a0[0][0]
c0[0][0]
reshape[51][0]
a0[0][0]
c0[0][0]
reshape[52][0]
a0[0][0]
c0[0][0]
reshape[53][0]
a0[0][0]
c0[0][0]
reshape[54][0]
a0[0][0]
c0[0][0]
reshape[55][0]
a0[0][0]
c0[0][0]
reshape[56][0]
a0[0][0]
c0[0][0]
reshape[57][0]
a0[0][0]
c0[0][0]
reshape[58][0]
a0[0][0]
c0[0][0]
reshape[59][0]
a0[0][0]
c0[0][0]
__________________________________________________________________________________________________
dense (Dense) (None, 90) 5850 lstm[30][1]
lstm[31][1]
lstm[32][1]
lstm[33][1]
lstm[34][1]
lstm[35][1]
lstm[36][1]
lstm[37][1]
lstm[38][1]
lstm[39][1]
lstm[40][1]
lstm[41][1]
lstm[42][1]
lstm[43][1]
lstm[44][1]
lstm[45][1]
lstm[46][1]
lstm[47][1]
lstm[48][1]
lstm[49][1]
lstm[50][1]
lstm[51][1]
lstm[52][1]
lstm[53][1]
lstm[54][1]
lstm[55][1]
lstm[56][1]
lstm[57][1]
lstm[58][1]
lstm[59][1]
==================================================================================================
Total params: 45,530
Trainable params: 45,530
Non-trainable params: 0