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

fix: Index out of bounds in symmetrize_spare_matrix #12

Merged
merged 1 commit into from
Feb 14, 2022

Conversation

EmilHernvall
Copy link
Contributor

Received this error intermittently:

thread 'main' panicked at 'index out of bounds: the len is 3173830 but the index is 3173830', /home/ehernva/.cargo/git/checkouts/bhtsne-5d23f839d3bdde38/69c58bf/src/tsne/mod.rs:347:17
stack backtrace:
0: rust_begin_unwind at /rustc/02072b482a8b5357f7fb5e5637444ae30e423c40/library/std/src/panicking.rs:498:5
1: core::panicking::panic_fmt at /rustc/02072b482a8b5357f7fb5e5637444ae30e423c40/library/core/src/panicking.rs:107:14
2: core::panicking::panic_bounds_check at /rustc/02072b482a8b5357f7fb5e5637444ae30e423c40/library/core/src/panicking.rs:75:5
3: bhtsne::tsne::symmetrize_sparse_matrix
4: bhtsne::tSNE<T,U>::barnes_hut
5: embed::main

I don't have an indepth understanding of this code, but it seems to me like the condition in the loop that calculates the number of columns per row is the opposite of the one that is used to increase the offsets in the main loop. From my testing, this seems to solve the problem, but probably worth thinking through that it's a valid fix before accepting this PR.

Received this error intermittently

thread 'main' panicked at 'index out of bounds: the len is 3173830 but the index is 3173830', /home/ehernva/.cargo/git/checkouts/bhtsne-5d23f839d3bdde38/69c58bf/src/tsne/mod.rs:347:17
stack backtrace:
0: rust_begin_unwind at /rustc/02072b482a8b5357f7fb5e5637444ae30e423c40/library/std/src/panicking.rs:498:5
1: core::panicking::panic_fmt at /rustc/02072b482a8b5357f7fb5e5637444ae30e423c40/library/core/src/panicking.rs:107:14
2: core::panicking::panic_bounds_check at /rustc/02072b482a8b5357f7fb5e5637444ae30e423c40/library/core/src/panicking.rs:75:5
3: bhtsne::tsne::symmetrize_sparse_matrix
4: bhtsne::tSNE<T,U>::barnes_hut
5: embed::main
@frjnn
Copy link
Owner

frjnn commented Feb 14, 2022

May I ask you to provide the code?

Edit: you are almost certainly right since that if guard should read "if _n is not present". Thank you!

@frjnn frjnn merged commit 8851d33 into frjnn:master Feb 14, 2022
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

Successfully merging this pull request may close these issues.

2 participants