gan3sh500 / local-relational-nets

A Pytorch implementation for the paper Local Relational Networks for Image Recognition (https://arxiv.org/pdf/1904.11491.pdf)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error in test using a random image

ParadoxRobotics opened this issue · comments

Hi !
Thank you for your impressive implementation of the Local relation layer.
I try to use it in a normal use case, but unfortunately your code doesn't work.
I write the following code and parameters :

img = torch.randn(1, 3, 64, 64)
att_layer = LocalRelationalLayer(channels = 3, k = 1, stride = 1, m = 1, padding = 0)
y = att_layer(img)

but I get following error for the ending line :

File "Deep_Compositional_Networks.py", line 99, in forward
pre_output = (ck * x_unfold).view(x.shape[0], x.shape[1], -1, x_unfold.shape[-2] // x.shape[1])
RuntimeError: shape '[1, 3, -1, 1365]' is invalid for input of size 12288

If you have any idea why this configuration raise this error...?

Thank in advance for your help !

You can refer to this example: #7 (comment)