Skip to content

Add seed property to Python Index #615

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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion python_bindings/bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -974,7 +974,9 @@ PYBIND11_PLUGIN(hnswlib) {
.def_property_readonly("M", [](const Index<float> & index) {
return index.index_inited ? index.appr_alg->M_ : 0;
})

.def_property_readonly("seed", [](const Index<float> & index) {
return index.seed;
})
.def(py::pickle(
[](const Index<float> &ind) { // __getstate__
return py::make_tuple(ind.getIndexParams()); /* Return dict (wrapped in a tuple) that fully encodes state of the Index object */
Expand Down