Skip to content

Conversation

@inexorabletash
Copy link
Contributor

Extend the WebNNUtil.argumentType() helper to handle option dictionary members, to improve the user experience.

Previously, number and array literals were serialized as JS numbers and arrays of numbers. This was great for linear(1, {alpha: 2, beta: 3}) and transpose(T, {permutation: [0,2,1]}). But it meant MLOperand dict members required passing via variables or using identity(), e.g. gemm(A, B, {c: identity(123)})

Now you can just write gemm(A, B, {c: 123}), but linear() and transpose() still work as before.

Extend the WebNNUtil.argumentType() helper to handle option dictionary
members, to improve the user experience.

Previously, number and array literals were serialized as JS numbers
and arrays of numbers. This was great for `linear(1, {alpha: 2, beta:
3})` and `transpose(T, {permutation: [0,2,1]})`. But it meant
MLOperand dict members required passing via variables or using
identity(), e.g. `gemm(A, B, {c: identity(123)})`

Now you can just write `gemm(A, B, {c: 123})`, but `linear()` and
`transpose()` still work as before.
@inexorabletash
Copy link
Contributor Author

Not urgent - just a minor improvement to the sample.

Copy link
Collaborator

@Honry Honry left a comment

Choose a reason for hiding this comment

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

👍

@inexorabletash inexorabletash merged commit fae1916 into webmachinelearning:master Jan 16, 2025
3 checks passed
@inexorabletash inexorabletash deleted the nnotepad-dicttypes branch January 16, 2025 18:56
@huningxin
Copy link
Contributor

👍

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.

3 participants