You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
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
The text was updated successfully, but these errors were encountered: