Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Data Science by (17.6k points)

When using the keras feature model.summary() it shows me the tensor shapes of my model which is very nice! Unfortunately, when using a encoder LSTM, called with the keras.layers.LSTM constructor with the property return_states=True, the summary is not displayed in its full form. It looks something like this:

Layer (type)                    Output Shape         Param #     Connected to                     

==================================================================================================

input (InputLayer)              (None, 34, 30)       0                                            

__________________________________________________________________________________________________

encoder (LSTM)                  [(None, 34, 30), (No 7320        input[0][0]                      

__________________________________________________________________________________________________

lambda_8 (Lambda)               (None, 34, 15)       0           encoder[0][0]                    

__________________________________________________________________________________________________

decoder (LSTM)                  (None, 34, 30)       5520        lambda_8[0][0]                   

                                                                 encoder[0][1]                    

                                                                 encoder[0][2]                    

==================================================================================================

Total params: 12,840

Trainable params: 12,840

Non-trainable params: 0

__________________________________________________________________________________________________

As you can see the output shape of the encoder is cut off and only the first of the three shapes is visible. Is there a way to display it, maybe a fix or even a workaround? :)

1 Answer

0 votes
by (17.6k points)

You can do this:

print(encoder.output_shape)

>> [(None, 34, 30), (None, 30), (None, 30)]

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...