webmachinelearning / webnn

🧠 Web Neural Network API
https://www.w3.org/TR/webnn/
Other
397 stars 48 forks source link

Write example decompositions as complete functions #709

Closed inexorabletash closed 5 months ago

inexorabletash commented 5 months ago

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

inexorabletash commented 5 months ago

@huningxin & @fdwr - please take a look?

inexorabletash commented 5 months ago

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.

zolkis commented 5 months ago

Yes, that sets a nice and clear context to the code snippets. Whether to enforce it... maybe not, as not every code snippet might be meant to be quoted as a full function.

inexorabletash commented 5 months ago

@huningxin take another look, and merge if it looks good? Thanks!