# How to change size of filter in torch model

**URL:** <https://discuss.pytorch.org/t/how-to-change-size-of-filter-in-torch-model/46317>\
**Category:** vision\
**Created:** [May 27, 2019, 12:05pm UTC](https://discuss.pytorch.org/t/how-to-change-size-of-filter-in-torch-model/46317 "2019-05-27T12:05:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![skyline](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/skyline/32/12514_2.png) [@skyline](https://discuss.pytorch.org/u/skyline)\
**Post date:** [May 27, 2019, 12:05pm UTC](https://discuss.pytorch.org/t/how-to-change-size-of-filter-in-torch-model/46317/1 "2019-05-27T12:05:57Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Geeks\_Sid](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/geeks_sid/32/10013_2.png) [@Geeks\_Sid](https://discuss.pytorch.org/u/Geeks_Sid)\
**Post date:** [May 27, 2019, 6:44pm UTC](https://discuss.pytorch.org/t/how-to-change-size-of-filter-in-torch-model/46317/2 "2019-05-27T18:44:30Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![skyline](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/skyline/32/12514_2.png) [@skyline](https://discuss.pytorch.org/u/skyline)\
**Post date:** [May 28, 2019, 1:45am UTC](https://discuss.pytorch.org/t/how-to-change-size-of-filter-in-torch-model/46317/3 "2019-05-28T01:45:05Z")

</div>

> [@Geeks\_Sid](#):
>
> size

But it will change the structure of the net.And how to implement remove/replace a layer in torch code?

---

<div class="post-metadata">

**Author:** ![Geeks\_Sid](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/geeks_sid/32/10013_2.png) [@Geeks\_Sid](https://discuss.pytorch.org/u/Geeks_Sid)\
**Post date:** [May 28, 2019, 1:50am UTC](https://discuss.pytorch.org/t/how-to-change-size-of-filter-in-torch-model/46317/4 "2019-05-28T01:50:16Z")

</div>

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](https://discuss.pytorch.org/t/how-to-delete-layer-in-pretrained-model/17648)
