-
Notifications
You must be signed in to change notification settings - Fork 6
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
Add start, stop, and temporal_policy to FeatureVector and FeatureVectorArray #549
Changes from 3 commits
7dff18d
76e5038
16e680d
b358b8a
cd00c38
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -182,9 +182,22 @@ void init_type_erased_module(py::module_& m) { | |
|
||
py::class_<FeatureVector>(m, "FeatureVector", py::buffer_protocol()) | ||
.def( | ||
py::init<const tiledb::Context&, const std::string&>(), | ||
py::keep_alive<1, 2>() // IndexIVFFlat should keep ctx alive. | ||
) | ||
"__init__", | ||
[](FeatureVector& instance, | ||
const tiledb::Context& ctx, | ||
const std::string& uri, | ||
size_t first_col, | ||
size_t last_col, | ||
std::optional<TemporalPolicy> temporal_policy) { | ||
new (&instance) | ||
FeatureVector(ctx, uri, first_col, last_col, temporal_policy); | ||
}, | ||
py::keep_alive<1, 2>(), | ||
py::arg("ctx"), | ||
py::arg("uri"), | ||
py::arg("first_col") = 0, | ||
py::arg("first_col") = 0, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, done. |
||
py::arg("temporal_policy") = std::nullopt) | ||
.def(py::init<size_t, const std::string&>()) | ||
.def(py::init<size_t, void*, const std::string&>()) | ||
.def("dimensions", &FeatureVector::dimensions) | ||
|
@@ -244,16 +257,18 @@ void init_type_erased_module(py::module_& m) { | |
const tiledb::Context& ctx, | ||
const std::string& uri, | ||
const std::string& ids_uri, | ||
size_t num_vectors, | ||
size_t first_col, | ||
size_t last_col, | ||
std::optional<TemporalPolicy> temporal_policy) { | ||
new (&instance) FeatureVectorArray( | ||
ctx, uri, ids_uri, num_vectors, temporal_policy); | ||
ctx, uri, ids_uri, first_col, last_col, temporal_policy); | ||
}, | ||
py::keep_alive<1, 2>(), // FeatureVectorArray should keep ctx alive. | ||
py::arg("ctx"), | ||
py::arg("uri"), | ||
py::arg("ids_uri") = "", | ||
py::arg("num_vectors") = 0, | ||
py::arg("first_col") = 0, | ||
py::arg("first_col") = 0, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, done. |
||
py::arg("temporal_policy") = std::nullopt) | ||
.def(py::init<size_t, size_t, const std::string&, const std::string&>()) | ||
.def("dimensions", &FeatureVectorArray::dimensions) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For better readability, it would be nice to follow the pattern bellow for such arguments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, thanks, done (though note it's a little different than this b/c a Python comment).