-
Notifications
You must be signed in to change notification settings - Fork 46
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
Write example decompositions as complete functions #709
Write example decompositions as complete functions #709
Conversation
This makes it clearer how the example decompositions map to the methods they are defining - variables are explicitly named as parameters, or unpacked from the arguments. No normative changes.
@huningxin & @fdwr - please take a look? |
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.
Thank you for wrapping these all in named functions - that makes it clearer 🧼😎.
FYI I'll look into lint tooling to help enforce this, but I didn't want to block on it. The easiest might be pulling eslint in as another node dependency, if that doesn't seem too bad. |
Yes, that sets a nice and clear context to the code snippets. |
@huningxin take another look, and merge if it looks good? Thanks! |
index.bs
Outdated
@@ -5950,8 +5945,9 @@ partial interface MLGraphBuilder { | |||
function where(builder, condition, input, other) { | |||
const c = builder.clamp(condition, {'minValue': 0, 'maxValue': 1}); | |||
builder.add( | |||
builder.mul(input, builder.cast(c, input.dataType())), | |||
builder.mul(other, builder.cast(builder.logicalNot(c), other.dataType()))); |
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 above two lines were good and won't need to change.
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.
Oops. :) Thanks.
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, thanks for the fix!
SHA: 588a728 Reason: push, by huningxin Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This makes it clearer how the example decompositions map to the methods they are defining - variables are explicitly named as parameters, or unpacked from the arguments.
Also fix code treating MLOperand's dataType() as a getter instead of a method.
No normative changes.
Preview | Diff