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 Multinomial kernel #7468

Merged
merged 7 commits into from
Mar 13, 2023
Merged

Conversation

chunnienc
Copy link
Collaborator

@chunnienc chunnienc commented Mar 10, 2023

And fixed a bug in tf.fill.
Surprisingly tfjs-node does not pass the new tests on seed. I will file an issue after merging this PR.

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


This change is Reviewable

@chunnienc chunnienc requested review from Linchenn and pyu10055 March 10, 2023 17:23
@chunnienc chunnienc marked this pull request as ready for review March 10, 2023 17:24
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.

Reviewed 9 of 9 files at r1, all commit messages.
Reviewable status: :shipit: complete! 1 of 1 approvals obtained (waiting on @Linchenn)

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 with a small nit.

Comment on lines +52 to +56
const probabilities = normalized ? logits : softmax({
inputs: {logits},
backend,
attrs: {dim: logits.shape.length - 1},
});
Copy link
Member

Choose a reason for hiding this comment

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

Nit: You might not need to normalize this. It looks like std::discrete_distribution normalizes it for you. No harm in normalizing it here too, though.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

std::discrete_distribution normalizes it with w'_i = w_i / sum(...w), not softmax.

@chunnienc chunnienc merged commit ff6739d into tensorflow:master Mar 13, 2023
@chunnienc chunnienc deleted the wasm-multinomial branch March 13, 2023 21:05
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.

4 participants