currently, I am trying to prune a network (simple convolutional autoencoder) - needless to say without success.
First of all, the source I am referring to is blog post:
http://machinethink.net/blog/compressing-deep-neural-nets/
In a first step, I just want to set a convolutional filter to zero, so that it does not contribute anymore. What I've tried so far is:
weights = model.get_weights() # weights is a numpy array
weights[2][0] = 0 # e.g. set the first filter of the second Conv2D-layer 0
weights[3][0] = 0 # and the filter's bias, of course
Afterwards, I initialize a new model with those weights:
newmodel.set_weights(weights)
and call:
newmodel.fit()
However, after retrieving the weights:
newweights = newmodel.get_weights()
newweights[2][0]
is not 0 anymore.
This means that my filter was updated, although, according to the article, it should not happen.
Can anyone tell me what I am doing wrong (Or how to do it correctly)?
Best,
Arepo