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

GridCellEncoder problems #163

Open
Thanh-Binh opened this issue Dec 13, 2022 · 2 comments
Open

GridCellEncoder problems #163

Thanh-Binh opened this issue Dec 13, 2022 · 2 comments

Comments

@Thanh-Binh
Copy link

Hi Martin,
this week I have time to look at your codes, and found somethings in "GridCell2d.hpp" that seem to be not-correct (sorry, if I am wrong!):

  1. The transformation matrix should not be inverted like
std::array<float, 4> mat = inv2x2({cosf(theta), -sinf(theta)
					,sinf(theta), cosf(theta)});

The correct formular should be:

std::array<float, 4> mat = {cosf(theta), -sinf(theta)
					,sinf(theta), cosf(theta)};
  1. you use a utils- function
    inline Tensor gridCell2d()
    for encoding the different 2d-position values of the same input source.
    But every call this utils function creats new GridCell modules with different scale/rotation etc, so that the encoding results may not be consistant (i.e. encoding results of the same position are different from call to call

What do you think? Thanks

@marty1885
Copy link
Member

marty1885 commented Dec 14, 2022

Long time! How's going on your side? New stuff?

  1. I think you are right. I vaguely remember there was a reason to use a inverse matrix (IIRC some semantic reason, not mathematical). But I can't recall now. Let me do some experiments and see if it there's a difference. But mathematically it should change nothing since inv(rotate(theta)) is just rotate(-theta). Thank you

  2. No, every call to gridCell2d() with the same parameters will result in the same tensor. The scale/rotation of the modules are controlled by the seed parameter and has a default value of 42. As long as you didn't change seed, the encoding result shouldn't change.

auto t1 = encoder::gridCell2d({2, 2});
auto t2 = encoder::gridCell2d({2, 2});
assert((t1 == t2).all() == true);

@Thanh-Binh
Copy link
Author

for 1. theoretically OK, but practically?
for 2.: OK

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

2 participants