The added layer must be an instance of class Layer. Found: <keras.layers.normalization.BatchNormalization object at 0x0000024B0C16B780>

I don't know why BatchNormalization is giving the following error. Googled out but couldn't find any relevant answers

My code appears to be this:

Topic batch-normalization keras tensorflow python

Category Data Science


How did you import "BatchNormalization" layer? I had the same error and the solution was changing the way I was importing:

from tensorflow.keras.layers import Activation, Dropout, Dense, Conv2D, Flatten, Dropout, MaxPooling2D, BatchNormalization

I put the BatchNormalization with all the other layers, and it work in my case.

Hope it is useful.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.