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

Main thread panicks in examples #24

Open
lucas-cauhe opened this issue Apr 13, 2022 · 0 comments
Open

Main thread panicks in examples #24

lucas-cauhe opened this issue Apr 13, 2022 · 0 comments

Comments

@lucas-cauhe
Copy link

I was trying out one of the examples in the examples folder when the execution failed due to:
thread 'main' panicked at 'source slice length (1) does not match destination slice length (2)'

The error refers to line 308 in src/hnsw/hnsw_const.rs. This happens since the minimum array length you're getting from the K-NN search is less than the default one set on the Opt object to hold nearest neighbors. Therefore copy_from_slice() panicks.

I managed to solve this by decreasing by 1 the default number (initially set to 2) of nearest neighbors in Opt structure since I think there will always be at least 1 node in the graph.

I believe there's a more sofisticated way to fix this, but I haven't yet found it 🙃

This is the full execution log

Generating 100 random bitstrings...
Done.
Generating 100 independent random query strings...
Done.
Computing the correct nearest neighbor distance for all 100 queries...
Done.
Generating HNSW...
Done.
Computing recall graph...
thread 'main' panicked at 'source slice length (1) does not match destination slice length (2)', /Users/cinderella/.cargo/registry/src/github.com-1ecc6299db9ec823/hnsw-0.11.0/src/hnsw/hnsw_const.rs:308:14
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
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

1 participant