-
Notifications
You must be signed in to change notification settings - Fork 2k
webgpu: support multinomial operator #7154
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
Conversation
| var p3 = fract(vec3<f32>(p.xyx) * HASHSCALE1); | ||
| p3 = p3 + dot(p3, p3.yzx + 19.19); | ||
| return fract((p3.x + p3.y) * p3.z); | ||
| } |
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.
We can put this in shader_util.ts, so that other code may share.
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.
The function could be only used for 2D coordinate axes. If we want to move it to shader_util.ts, we should design a more common function for 1~4D coordinate axes on webgpu backend. Is it OK to do it in the future if necessary?
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.
Sure, we can make it a util function when necessary in the future.
| f32(coords[0]) / f32(uniforms.outShape[0])); | ||
| let r = random(uniforms.seed, resUV); | ||
| var cdf = 0.0; | ||
| for (var i = 0; i < uniforms.numOutcomes; i = i + 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.
In WebGL impl, it's (uniforms.numOutcomes -1) here.
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.
Thanks for finding the error.
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.
Is it easy to add a case to catch such kind of error?
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.
r is random value, I think it is difficult to design the case.
599798d to
522a61d
Compare
|
@gyagp PTAL |
To see the logs from the Cloud Build CI, please join either our discussion or announcement mailing list.
This change is