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

[wasm] Add SearchSorted kernel #7299

Merged
merged 3 commits into from
Jan 25, 2023

Conversation

chunnienc
Copy link
Collaborator

@chunnienc chunnienc commented Jan 25, 2023

To see the logs from the Cloud Build CI, please join either our discussion or announcement mailing list.


This change is Reviewable

Copy link
Member

@mattsoulanille mattsoulanille left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

for (int i = 0; i < values_size; ++i) {
if (is_lower_bound) {
out_it[i] =
std::lower_bound(seq_it, seq_it + sequence_size, val_it[i]) -
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does std::lower_bound know that the sequence is sorted? We should be able to get O(log(n)) performance for this search, but we might be getting O(n).

Actually, looks like std::lower_bound uses binsearch.

Copy link
Collaborator

@Linchenn Linchenn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@chunnienc chunnienc merged commit e57a7c6 into tensorflow:master Jan 25, 2023
@chunnienc chunnienc deleted the wasm-search-sorted branch January 25, 2023 22:47
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.

3 participants