For example, squezeenet1_1 can only input some specific size of the image. Others sizes will raise an error.can we change the filter size?
Basically the issue arises if your network is not fully convolutional, that is, if it consists of some Linear layers(Fully connected). Try removing those and you can probably get away with any input size you would like.
But it will change the structure of the net.And how to implement remove/replace a layer in torch code?
No, It would not change the structure of the network.
Anyhow, replacing a layer or removing would definitely change the intermediate structure of the network.
There are a lot of tutorials about removing the layers. Follow here