hans66hsu / nn_interpretability

Pytorch implementation of various neural network interpretability methods
MIT License
109 stars 20 forks source link

LRP converting FC to CONV #2

Closed hanxiaoTan closed 2 years ago

hanxiaoTan commented 2 years ago

Thanks for the excellent work!

I have a question, is it necessary to convert fully-connected strata to convolutional layers?

My model was not build in pytorch sequence, so I removed the outer traversal of the model but then traversing the model causes problem:

newlayer.weight = nn.Parameter(module.weight.reshape(n, channel_out, h_w[0], h_w[1]))

RuntimeError: shape '[128, 64, 24, 24]' is invalid for input of size 1179648

seems like the target number of parameters are multiple times larger than it should be..

hanxiaoTan commented 2 years ago

Solved, it was the problem of pooling layer