I have to remove filter from layers.
VGG16 model, here are two layer
model = models.vgg16(pretrained=True)
print(model)
print(model.features[2].weight.shape) # features[2].weight has 64 filters
torch.Size([64, 64, 3, 3])
print(model.features[5].weight.shape) # features[5].weight has 128 filters
torch.Size([128, 64, 3, 3])
Is there any way (function or method) to remove filter#53 from model.features[2].weight and filter#109 from features[5].weight.
Also:
How to initialize model.features[5].weight of VGG16 with custom filter weights of same shape.
model = models.vgg16(pretrained=True)
print(model)
print(model.features[5].weight.shape)
torch.Size([128, 64, 3, 3])
Thanks