Skip to content

Comments

Editorial: Make "generically emulated" text a macro, update wording#638

Merged
fdwr merged 1 commit intowebmachinelearning:mainfrom
inexorabletash:emulation-decomp
Apr 16, 2024
Merged

Editorial: Make "generically emulated" text a macro, update wording#638
fdwr merged 1 commit intowebmachinelearning:mainfrom
inexorabletash:emulation-decomp

Conversation

@inexorabletash
Copy link
Contributor

@inexorabletash inexorabletash commented Apr 5, 2024

Many complex operations in the spec are given decompositions, showing how the operation could be replaced through the use of more primitive operations. This text is repeated in many places. Improve this in two ways:

  • Use Bikeshed's Text Macro[1] to reduce the repetition.

  • Streamline the text, and make it explicit that if the underlying platform doesn't support an operation, WebNN API implementations can use the decomposition as a guide to emulate it.

The macro [EMULATED] is used at the end of an intro sentence since there are variations - some of the decompositions are grouped, and some make assumptions (e.g. activation functions, layouts, etc).

If we assume that implementations must implement all operations in the spec, either via the underlying platform or emulation, this fixes #187

[1] https://speced.github.io/bikeshed/#metadata-text-macro


Preview | Diff

Many complex operations in the spec are given decompositions, showing
how the operation could be replaced through the use of more primitive
operations. This text is repeated in many places. Improve this in two
ways:

* Use Bikeshed's Text Macro[1] to reduce the repetition.

* Streamline the text, and make it explicit that if the underlying
  platform doesn't support an operation, WebNN API implementations can
  use the decomposition as a guide to emulate it.

The macro [EMULATED] is used at the end of an intro sentence since
there are variations - some of the decompositions are grouped, and
some make assumptions (e.g. activation functions, layouts, etc).

If we assume that implementations must implement all operations in the
spec, either via the underlying platform or emulation, this fixes #187

[1] https://speced.github.io/bikeshed/#metadata-text-macro
Copy link
Member

@anssiko anssiko left a comment

Choose a reason for hiding this comment

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

I note we have one outlier case in https://www.w3.org/TR/webnn/#api-mlgraphbuilder-reshape-method where a similar (but not the same) note is added for squeeze, unsqueeze, and flatten ops that are not part of the API:

Many shape-related operations such as squeeze, unsqueeze, and flatten can be generically implemented using the reshape() operation as follows:

Quickly glimpsing over the spec a reader might think those three ops are also part of the API. There's a subtle difference in the wording: "generically implemented" vs. "generically emulated". This is probably intentional but could mislead readers until they click the links and land on PyTorch API docs.

Noting this here because it caught my eye while reviewing. The PR is good as is. My comment can be addressed here or separately as deemed appropriate.

@inexorabletash
Copy link
Contributor Author

I note we have one outlier case in https://www.w3.org/TR/webnn/#api-mlgraphbuilder-reshape-method where a similar (but not the same) note is added for squeeze, unsqueeze, and flatten ops that are not part of the API:

#598 should make that clearer; wording can also be tweaked.

Copy link
Contributor

@huningxin huningxin left a comment

Choose a reason for hiding this comment

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

LGTM!

@huningxin
Copy link
Contributor

@fdwr , do you have any further comments?

@fdwr fdwr merged commit 954ed19 into webmachinelearning:main Apr 16, 2024
github-actions bot added a commit that referenced this pull request Apr 16, 2024
…638)

SHA: 954ed19
Reason: push, by fdwr

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@inexorabletash inexorabletash deleted the emulation-decomp branch April 16, 2024 15:58
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.

BatchNormalization should be an optional operation

5 participants