Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the code in "kdnet.py" may be wrong #9

Open
qiqihaer opened this issue Dec 17, 2018 · 3 comments
Open

the code in "kdnet.py" may be wrong #9

qiqihaer opened this issue Dec 17, 2018 · 3 comments

Comments

@qiqihaer
Copy link

In my opinion, the index selection part in the "KDNet_Batch" in "kdnet.py" may be wrong. The offset addition part of variable "sel" makes that the order in "sel" can not match the real points' order in "x".
The mistake can be fixed by change
"sel = Variable(sel + (torch.arange(0,dim) * 3).repeat(batchsize,1).long()).view(-1,1)"
into
"sel = Variable(sel * dim + torch.arange(0,dim).repeat(batchsize,1).long()).view(-1,1)"

@qiqihaer qiqihaer changed the title the code may be wrong in kdnet the code in "kdnet.py" may be wrong Dec 17, 2018
@matherm
Copy link

matherm commented Feb 25, 2019

How does this fix the failure? When I run the code, it crashes at the mentioned line with:
inconsistent tensor size, expected r_ [2], t [2] and src [2048] to have the same number of elements, but got 2, 2 and 2048 elements respectively at)

This happens in both train.py (line 38) and test.py (line 36).

I cannot even see how this line can ever run? I mean sel in
sel = Variable(sel + (torch.arange(0, dim) * 3).long()) is of shape (2,) in case c[-1] and (torch.arange(0, dim) is of shape (2048,).

Is the addition really correct here? Or is c maybe in reverse order and we should write c[0..11] instead of c[-1..-11] which makes more sense to me and removes the error. But I'm not sure if this is mathematically correct.

Best wishes,
Matthias

@fpshuang
Copy link

@matherm I came into the same problem. Did you solve this problem?

@dhliubj
Copy link

dhliubj commented Jul 5, 2022

The solution can be found in (#11 (comment)).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants