-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Conversation
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.
Reviewed 9 of 9 files at r1, all commit messages.
Reviewable status: complete! 1 of 1 approvals obtained (waiting on @Linchenn)
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.
LGTM with a small nit.
const probabilities = normalized ? logits : softmax({ | ||
inputs: {logits}, | ||
backend, | ||
attrs: {dim: logits.shape.length - 1}, | ||
}); |
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.
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.
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.
std::discrete_distribution
normalizes it with w'_i = w_i / sum(...w)
, not softmax.
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