During the pruning step, I zero out some filters of a Depthwise convolution. After doing this, I need to retrain the network but those weights that have been zeroed out (I have the list of indexes) should not be updated during the training, their values need to remain equal to zero. So if I have 150 filters in the Depthwise layer (I'm not counting the bias), is there any way to freeze just a subset of them?
For example, the weights of the filters are x
:
x=model.layers[4].get_weights()[0]
And x
is a ndarray of 150 numbers. Ideally, if I have the list of zeroed out indices pruned_filters
, I would like to do something like:
x[pruned_filters].trainable = False # I know this is wrong, it's just an example
Or move them to the non_trainable_weights