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] Implement the Round kernel #4486

Merged
merged 1 commit into from
Jan 5, 2021

Conversation

mattsoulanille
Copy link
Member

@mattsoulanille mattsoulanille commented Jan 5, 2021

Implement the Round kernel using XNNPACK's banker's rounding. Banker's rounding rounds to the nearest integer, but breaks ties in the direction of the nearest even integer. It passes our tests, but might not be desirable. XNNPACK doesn't seem to expose a 'normal' rounding operator that always rounds up in the case of a tie.

Closes #4434

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


This change is Reviewable

@annxingyuan
Copy link
Collaborator

Thanks Matt! Sorry if I've misunderstood, but it seems like our CPU / WebGL backends both use banker's rounding as well? Could you confirm that they boil down to the same algorithm?

If so then this PR looks great - if not then I would avoid using XNNPACK and implement the kernel by hand.

@mattsoulanille
Copy link
Member Author

I should have checked CPU and WebGL first. They also use banker's rounding, so this PR's implementation should be fine.

Copy link
Collaborator

@annxingyuan annxingyuan 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 Matt!

@mattsoulanille mattsoulanille merged commit a44c291 into tensorflow:master Jan 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[wasm] Add Round kernel. Unblocks efficientdet models.
2 participants