AhmedImtiazPrio / splinecam

Exact method for visualizing partitions of a Deep Neural Network, CVPR 2023 Highlight
https://imtiazhumayun.github.io/splinecam
MIT License
89 stars 8 forks source link

Issue with the wrappers applied on avgpool2d #10

Open BabaVegato opened 8 months ago

BabaVegato commented 8 months ago

Hello,

In the code I can see this in wrappers.py for the avgpool2d :

enforcing symmetric

    if self.layer.kernel_size == 2:
        assert self.layer.padding == 0
    elif self.layer.kernel_size>2:
        assert self.layer.kernel_size[0] - 2*self.layer.padding[0] == 1

Knowing that my kernel_size is > 2, I either : -get an error because my kernel_size is an int, and ints are not subscriptable (kernel_size[0]) -get an error because my kernel_szie is a tuple, and the comparison kernel_size > 2 isn't possible

Am I getting this wrong ?

AhmedImtiazPrio commented 7 months ago

Hey @BabaVegato. Looks like a clear mistake from my side. I don't think any of the kernel_size and padding rules are required since the affine params of avgpool is computed using convolutions. Removing these asserts and just adding a symmetric stride assert.

BabaVegato commented 7 months ago

Thanks a lot for all the work !