Add a new layer to an existing model

34 views Asked by At

Is it possible to add a new layer to an existing model? Consider the following model.

model = Sequential([
    Resizing(...),
    Dense(...),
    Dense(...),
    Dense(...),
])

What I'm expecting is to add a new augmentation preprocessing layer after the initial Resizing layer.

data_augmentation = Sequential([
    RandomZoom(...),
])

model2 = clone_model(model)
model2.layers.insert(1, data_augmentation)

Though insert function is successful I don't see the new layer in the model2. Is this possible?

0

There are 0 answers