2
$\begingroup$

Every time I print the model summary it prints out the convlstm first and then batchnormalization at the end.

Here is the output of model.summary

|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|
| conv_lstm2d (ConvLSTM2D)  multiple                  416256    |
|                                                               |
| conv_lstm2d_1 (ConvLSTM2D)  multiple                295168    |
|                                                               |
| conv_lstm2d_2 (ConvLSTM2D)  multiple                33024     |
|                                                               |
| batch_normalization (BatchN  multiple               256       |
| ormalization)                                                 |
|                                                               |
| batch_normalization_1 (Batc  multiple               256       |
| hNormalization)                                               |
|_______________________________________________________________|

I want the batch_normalization layer after every conv_lstm2d except for the last layer.

$\endgroup$

1 Answer 1

4
$\begingroup$

It looks like you're seeing this issue: BUG!! tf.keras.model.summary() output is wrong. When you use the subclass API, the summary() method prints the layers in the order they are created, not the order they appear in the network. If you plot the network using the plot_model utility, this should output the layers in the correct order (output goes to a png file).

$\endgroup$
1
  • $\begingroup$ Aren't the batch norm layers created before the conv layers too though? they are interleaved both during creation and when applying it.. $\endgroup$
    – Ant
    Commented Nov 20, 2022 at 10:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.