-
Notifications
You must be signed in to change notification settings - Fork 334
Closed
Labels
technique:pruningRegarding tfmot.sparsity.keras APIs and docsRegarding tfmot.sparsity.keras APIs and docs
Description
I tried to create a model like:
`def Vgg16():
vgg16 = VGG16(include_top=False,
weights='imagenet',
input_shape = (32, 32, 3))
top_model = Sequential()
top_model.add(Flatten(input_shape=vgg16.output_shape[1:]))
top_model.add(Dense(512, activation='relu'))
top_model.add(Dropout(0.5))
top_model.add(Dense(256, activation='relu'))
top_model.add(Dropout(0.5))
top_model.add(Dense(10, activation='sigmoid'))
model = Model(vgg16.input,top_model(vgg16.output))
return model`
and when I call
`new_pruning_params = {
'pruning_schedule': sparsity.PolynomialDecay(initial_sparsity=0.5,
final_sparsity=0.80,
begin_step=0,
end_step=end_step,
frequency=100)
}
**pruned_model = sparsity.prune_low_magnitude(loaded_model, **new_pruning_params)`**
it generates error as:
Please initialize Prune with a supported layer. Layers should either be a PrunableLayer instance, or should be supported by the PruneRegistry. You passed: <class 'tensorflow.python.keras.engine.sequential.Sequential'>
Metadata
Metadata
Assignees
Labels
technique:pruningRegarding tfmot.sparsity.keras APIs and docsRegarding tfmot.sparsity.keras APIs and docs