-
Notifications
You must be signed in to change notification settings - Fork 48
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
Reconsider MLOperand
methods
#666
Comments
m2c: 3(2|1) |
I agree that we should do (3) regardless. Filed #669 to track that Also filed #670 to track making Given those expected improvements, my preference is (1) |
Re: (2) - sequences are disallowed as the type of an attribute: https://webidl.spec.whatwg.org/#idl-sequence
... which is a shame as a method does seem like overkill. |
Doh, as a fan of internal consistency in API's, I should have originally proposed interface MLOperand {
MLOperandDataType dataType();
- sequence<unsigned long> shape();
+ sequence<unsigned long> dimensions();
} Options:(a) Change helper Pros/Cons(a) Change helper
(b) Change field
So it really doesn't look like |
p.s. Let's also be consistent in...
|
Hmm I'm still inclined to prefer
|
I forgot I'd filed a separate issue about this! Please feel free to respond on #669 :) Regardless of what we name that field, at this point I'm quite convinced we should convert the getter methods on interface MLOperand {
- MLOperandDataType dataType();
+ readonly attribute MLOperandDataType dataType;
- sequence<unsigned long> shape();
+ readonly attribute FrozenArray<unsigned long> shape;
}; |
@a-sully I'm not opposed to that (fewer parentheses to type), but what of Anssi's comment here? #670 (comment)
|
In this case we're using
|
@a-sully: Do you consider
|
I'm now happy with As I mentioned in #666 (comment), I still think the
|
As proposed in webmachinelearning/webnn#666 Bug: 365813262 Cq-Include-Trybots: luci.chromium.try:mac14-blink-rel,win11-blink-rel Change-Id: I1fb29ee349ee527a574dc7e135200f8e774d709b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5975719 Auto-Submit: Austin Sullivan <[email protected]> Reviewed-by: ningxin hu <[email protected]> Commit-Queue: ningxin hu <[email protected]> Cr-Commit-Position: refs/heads/main@{#1375719}
As proposed in webmachinelearning/webnn#666 Bug: 365813262 Cq-Include-Trybots: luci.chromium.try:mac14-blink-rel,win11-blink-rel Change-Id: I1fb29ee349ee527a574dc7e135200f8e774d709b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5975719 Auto-Submit: Austin Sullivan <[email protected]> Reviewed-by: ningxin hu <[email protected]> Commit-Queue: ningxin hu <[email protected]> Cr-Commit-Position: refs/heads/main@{#1375719}
As proposed in webmachinelearning/webnn#666 Bug: 365813262 Cq-Include-Trybots: luci.chromium.try:mac14-blink-rel,win11-blink-rel Change-Id: I1fb29ee349ee527a574dc7e135200f8e774d709b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5975719 Auto-Submit: Austin Sullivan <[email protected]> Reviewed-by: ningxin hu <[email protected]> Commit-Queue: ningxin hu <[email protected]> Cr-Commit-Position: refs/heads/main@{#1375719}
…vor of readonly attributes, a=testonly Automatic update from web-platform-tests webnn: Deprecate MLOperand members in favor of readonly attributes As proposed in webmachinelearning/webnn#666 Bug: 365813262 Cq-Include-Trybots: luci.chromium.try:mac14-blink-rel,win11-blink-rel Change-Id: I1fb29ee349ee527a574dc7e135200f8e774d709b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5975719 Auto-Submit: Austin Sullivan <[email protected]> Reviewed-by: ningxin hu <[email protected]> Commit-Queue: ningxin hu <[email protected]> Cr-Commit-Position: refs/heads/main@{#1375719} -- wpt-commits: 88b1811adb9a1983fce2908aba6f44261903eea2 wpt-pr: 48877
…vor of readonly attributes, a=testonly Automatic update from web-platform-tests webnn: Deprecate MLOperand members in favor of readonly attributes As proposed in webmachinelearning/webnn#666 Bug: 365813262 Cq-Include-Trybots: luci.chromium.try:mac14-blink-rel,win11-blink-rel Change-Id: I1fb29ee349ee527a574dc7e135200f8e774d709b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5975719 Auto-Submit: Austin Sullivan <asullychromium.org> Reviewed-by: ningxin hu <ningxin.huintel.com> Commit-Queue: ningxin hu <ningxin.huintel.com> Cr-Commit-Position: refs/heads/main{#1375719} -- wpt-commits: 88b1811adb9a1983fce2908aba6f44261903eea2 wpt-pr: 48877 UltraBlame original commit: 3a506099528bb52152dddf0ee14408935452eef5
…vor of readonly attributes, a=testonly Automatic update from web-platform-tests webnn: Deprecate MLOperand members in favor of readonly attributes As proposed in webmachinelearning/webnn#666 Bug: 365813262 Cq-Include-Trybots: luci.chromium.try:mac14-blink-rel,win11-blink-rel Change-Id: I1fb29ee349ee527a574dc7e135200f8e774d709b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5975719 Auto-Submit: Austin Sullivan <asullychromium.org> Reviewed-by: ningxin hu <ningxin.huintel.com> Commit-Queue: ningxin hu <ningxin.huintel.com> Cr-Commit-Position: refs/heads/main{#1375719} -- wpt-commits: 88b1811adb9a1983fce2908aba6f44261903eea2 wpt-pr: 48877 UltraBlame original commit: 3a506099528bb52152dddf0ee14408935452eef5
…vor of readonly attributes, a=testonly Automatic update from web-platform-tests webnn: Deprecate MLOperand members in favor of readonly attributes As proposed in webmachinelearning/webnn#666 Bug: 365813262 Cq-Include-Trybots: luci.chromium.try:mac14-blink-rel,win11-blink-rel Change-Id: I1fb29ee349ee527a574dc7e135200f8e774d709b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5975719 Auto-Submit: Austin Sullivan <asullychromium.org> Reviewed-by: ningxin hu <ningxin.huintel.com> Commit-Queue: ningxin hu <ningxin.huintel.com> Cr-Commit-Position: refs/heads/main{#1375719} -- wpt-commits: 88b1811adb9a1983fce2908aba6f44261903eea2 wpt-pr: 48877 UltraBlame original commit: 3a506099528bb52152dddf0ee14408935452eef5
…vor of readonly attributes, a=testonly Automatic update from web-platform-tests webnn: Deprecate MLOperand members in favor of readonly attributes As proposed in webmachinelearning/webnn#666 Bug: 365813262 Cq-Include-Trybots: luci.chromium.try:mac14-blink-rel,win11-blink-rel Change-Id: I1fb29ee349ee527a574dc7e135200f8e774d709b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5975719 Auto-Submit: Austin Sullivan <[email protected]> Reviewed-by: ningxin hu <[email protected]> Commit-Queue: ningxin hu <[email protected]> Cr-Commit-Position: refs/heads/main@{#1375719} -- wpt-commits: 88b1811adb9a1983fce2908aba6f44261903eea2 wpt-pr: 48877
…vor of readonly attributes, a=testonly Automatic update from web-platform-tests webnn: Deprecate MLOperand members in favor of readonly attributes As proposed in webmachinelearning/webnn#666 Bug: 365813262 Cq-Include-Trybots: luci.chromium.try:mac14-blink-rel,win11-blink-rel Change-Id: I1fb29ee349ee527a574dc7e135200f8e774d709b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5975719 Auto-Submit: Austin Sullivan <[email protected]> Reviewed-by: ningxin hu <[email protected]> Commit-Queue: ningxin hu <[email protected]> Cr-Commit-Position: refs/heads/main@{#1375719} -- wpt-commits: 88b1811adb9a1983fce2908aba6f44261903eea2 wpt-pr: 48877
The
MLOperand
interface looks like:Each of these methods meets the criteria for being an attribute (https://w3ctag.github.io/design-principles/#attributes-vs-methods), and are const once the
MLOperand
is constructed. Is we are to have an accessor onMLOperand
for each key in theMLOperandDescriptor
which created it, then these should bereadonly attribute
s.That being said, once we open this can of worms, there are several options we could choose from:
1. Getter which returns an
MLOperandDescriptor
This is my preferred option. Unfortunately, JavaScript dictionaries are not read-only so (unless we want to push to introduce
FrozenDictionary
) we should use a getter.2. Naive conversion to
readonly attribute
Seems reasonable. But why have an attribute called
shape
which refers to the same thing asMLOperandDescriptor.dimensions
?3. Rename
shape
todimensions
, or vice versaMLOperandDescriptor
takes adimensions
field, while querying this field from anMLOperand
is done with theshape()
method. As per https://w3ctag.github.io/design-principles/#attribute-reuse, we should re-use terms rather than unnecessarily introducing new vocabulary.A quick CTRL-F of the spec text shows:
MLOperandDescriptor.dimensions
We should decide to use one or the other (and possibly continue this discussion on another issue regardless)
4. Make
MLOperandDescriptor
aninterface
This is my least favorite, but I figured I'd list this here for completeness.
The text was updated successfully, but these errors were encountered: