webmachinelearning / webnn

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

Add optional operator labels for more diagnosable error messages #742

Closed inexorabletash closed 4 months ago

inexorabletash commented 4 months ago

This adds an internal 'label' property to the operators that are created as a graph is constructed, which MAY (in the RFC 2119 sense) be used by implementations in async error messages. Developers populate this via a 'label' member in the options dictionary for MLGraphBuilder methods.

A new MLOperatorOptions dictionary is defined, and all existing options dictionaries now inherit from this, and all relevant methods now take an options dictionary.

This is based on the Chromium prototype by @lisa0314

Fixes #585


Preview | Diff

inexorabletash commented 4 months ago

@lisa0314 and @philloooo - can you do an initial review to ensure this matches the Chromium prototype?

lisa0314 commented 4 months ago

LGTM. 👍

inexorabletash commented 4 months ago

Thank you @lisa0314 & @philloooo !

Editors - @huningxin & @fdwr - could you please review and merge when ready?

inexorabletash commented 4 months ago

please merge when ready!