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

Add LowerBound and UpperBound kernels #6356

Merged
merged 3 commits into from
May 2, 2022
Merged

Add LowerBound and UpperBound kernels #6356

merged 3 commits into from
May 2, 2022

Conversation

ahmedsabie
Copy link
Contributor

@ahmedsabie ahmedsabie commented Apr 29, 2022

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


This change is Reviewable

@ahmedsabie ahmedsabie requested review from pyu10055 and lina128 April 29, 2022 11:06
Copy link
Collaborator

@lina128 lina128 left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 1 of 1 approvals obtained (waiting on @ahmedsabie and @pyu10055)


tfjs-core/src/ops/lower_bound.ts line 72 at r1 (raw file):

function lowerBound_(
    sortedSequence: Tensor|TensorLike, values: Tensor|TensorLike): Tensor {
  return searchSorted_(sortedSequence, values, 'left');

Should we just call searchSorted op?

Code quote:

searchSorted_(sortedSequence, values, 'left');

tfjs-core/src/ops/upper_bound.ts line 59 at r1 (raw file):

function upperBound_(
    sortedSequence: Tensor|TensorLike, values: Tensor|TensorLike): Tensor {
  return searchSorted_(sortedSequence, values, 'right');

Same, call the op.

Code quote:

searchSorted_(sortedSequence, values, 'right')

Copy link
Collaborator

@pyu10055 pyu10055 left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 1 of 1 approvals obtained (waiting on @ahmedsabie)


tfjs-core/src/ops/lower_bound.ts line 52 at r1 (raw file):

 *
 * const seq = tf.tensor1d([0, 3, 9, 10, 10]);
 * values = tf.tensor1d([0, 4, 10]);

the snippet test is failing:

const values

same for the one below


tfjs-core/src/ops/upper_bound.ts line 46 at r1 (raw file):

 * ```js
 * const seq = tf.tensor1d([0, 3, 9, 10, 10]);
 * values = tf.tensor1d([0, 4, 10]);

const values

@ahmedsabie ahmedsabie requested a review from pyu10055 May 2, 2022 18:05
@pyu10055 pyu10055 merged commit 81ac4da into master May 2, 2022
@pyu10055 pyu10055 deleted the upper-lower-bound branch May 2, 2022 20:31
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