How do I take an existing model and create a new one that has batchnormalisation after each dropout layer?
I have tried this:
bn = []
for layer in model.layers:
bn.append(layer)
if type(layer) is Dropout:
bn.append(BatchNormalization())
bn = Sequential(bn)
bn.summary()
Looking at the summary it has inserted the new layers. However in the "connected to" column it lists the predecessor twice; if I run it n times it lists each predecessor n+1 times.
For example in the "connected to" for a maxpool layer:
convolution2d_394[0][0]
convolution2d_394[1][0]
convolution2d_394[2][0]
convolution2d_394[3][0]
convolution2d_394[4][0]
convolution2d_394[5][0]
convolution2d_394[6][0]
convolution2d_394[7][0]
convolution2d_394[8][0]
convolution2d_394[9][0]