Add the builder.input() method steps#364
Conversation
|
@huningxin PTAL :) |
index.bs
Outdated
| 1. If |name| is `undefined` or an empty [=string=], then throw a "{{TypeError}}" {{DOMException}} and stop. | ||
| 1. Let |descriptor| be the second argument. | ||
| 1. If |descriptor| is not an an object that [=implements=] {{MLOperandDescriptor}}, then throw a "{{TypeError}}" {{DOMException}} and stop. | ||
| 1. If the [=byte length=] of |descriptor| is not supported by the underlying platform, then throw a "{{DataError}}" {{DOMException}} and stop. |
There was a problem hiding this comment.
nit: one extra space before "If"
index.bs
Outdated
| 1. Let |descriptor| be the second argument. | ||
| 1. If |descriptor| is not an an object that [=implements=] {{MLOperandDescriptor}}, then throw a "{{TypeError}}" {{DOMException}} and stop. | ||
| 1. If the [=byte length=] of |descriptor| is not supported by the underlying platform, then throw a "{{DataError}}" {{DOMException}} and stop. | ||
| 1. If the [=check dimensions=] steps given |descriptor|.{{MLOperandDescriptor/type}} and |descriptor|.{{MLOperandDescriptor/dimensions}} return `false`, throw a "{{DataError}}" {{DOMException}} and stop. |
There was a problem hiding this comment.
What would happen if user code passes a descriptor for scalar operand (dimensions is undefined)? This input() algorithm seems only to support tensor operand now.
There was a problem hiding this comment.
Actually, the constant(descriptor, bufferView) algorithm in PR #365 should also address this issue.
There was a problem hiding this comment.
Right. So this is where conventions about descriptor become important.
I am thinking if it's enough to distinguish between vector and scalar solely on the existence of a dimensions member. But for now let's continue with that working assumption and keep it in mind.
About constant(descriptor, bufferView): the descriptor.dimensions must be defined, otherwise it's an error. There is a polymorphic variant for specifying scalar constant. Should we change that?
There was a problem hiding this comment.
Done, please check if correct. Using an assert seemed better choice than just making a note.
Forgot to fix the white space error, such a small change that I amended the same commit and force-pushed.
There was a problem hiding this comment.
About constant(descriptor, bufferView): the descriptor.dimensions must be defined, otherwise it's an error.
That's fine. No change needed.
563ff94 to
d6abd76
Compare
index.bs
Outdated
| 1. If |descriptor| is not an an object that [=implements=] {{MLOperandDescriptor}}, then throw a "{{TypeError}}" {{DOMException}} and stop. | ||
| 1. If the [=byte length=] of |descriptor| is not supported by the underlying platform, then throw a "{{DataError}}" {{DOMException}} and stop. | ||
| 1. If the [=check dimensions=] steps given |descriptor|.{{MLOperandDescriptor/type}} and |descriptor|.{{MLOperandDescriptor/dimensions}} return `false`, throw a "{{DataError}}" {{DOMException}} and stop. | ||
| 1. If the [=byte length=] of |descriptor| is not supported by the underlying platform, then throw a "{{DataError}}" {{DOMException}} and stop. |
There was a problem hiding this comment.
"byte length" algorithm also need to handle scalar operand descriptor. Its current definition would break if descriptor.dimensions is undefined.
index.bs
Outdated
| 1. Let |descriptor| be the second argument. | ||
| 1. If |descriptor| is not an an object that [=implements=] {{MLOperandDescriptor}}, then throw a "{{TypeError}}" {{DOMException}} and stop. | ||
| 1. If the [=byte length=] of |descriptor| is not supported by the underlying platform, then throw a "{{DataError}}" {{DOMException}} and stop. | ||
| 1. If the [=check dimensions=] steps given |descriptor|.{{MLOperandDescriptor/type}} and |descriptor|.{{MLOperandDescriptor/dimensions}} return `false`, throw a "{{DataError}}" {{DOMException}} and stop. |
There was a problem hiding this comment.
About constant(descriptor, bufferView): the descriptor.dimensions must be defined, otherwise it's an error.
That's fine. No change needed.
|
@zolkis , you may also want to solve the conflicts, squash the commits and edit the commit log before merging. Thanks! |
Squashed the following commits:
Fix links in algorithm
Enclose arg+return description as a note for better clarity
Add reference to the platform operand object
Handle the scalar case
Move byte length check to vector section
Signed-off-by: Zoltan Kis <zoltan.kis@intel.com>
also provide SVG source
Reword and refine the text based on review feeedback
Make the text more concise to address review feedback
as discussed in w3c/transitions#491
1. Change `starts` and `sizes` parameters to be sequence of unsigned long. 2. Remove `MLSliceOptions.axes`. Fix webmachinelearning#369
* Draft * More text. * mote text * Address PR feedbacks.
Squashed the following commits:
Enclose arg + return descriptions to separate from normative algorithms
Change manual link to autolink
Use the 'get a copy' reference for buffer source
Factor our validating bufferview with descriptor
Fix initialization typo
Add reference to the platform operand object MLOperand/[[operand]]
Lift dependency changes from webmachinelearning#337
Fix typos, remove unneeded dependencies from webmachinelearning#337
Add dependency for buffer validation from webmachinelearning#329
Fix the scalar algorithm / comments
Discern between scalar and tensor constant, fix typos
Fix review comments. Add stylistic boxes for algorithm steps, informal steps, internal slots
Fix typo. Remove stylistic boxes for now.
Address reviews comments. Remove MLOperandKind typedef from the IDL.
Move note to text. Make the check on kind an assert.
Remove the MLOperand/[[kind]] internal slot and creation parameter.
Remove back quotes from title
Signed-off-by: Zoltan Kis <zoltan.kis@intel.com>
1a1a0d4 to
c5f1574
Compare
Signed-off-by: Zoltan Kis <zoltan.kis@intel.com>
|
@huningxin |
SHA: 9774d49 Reason: push, by huningxin Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Add the input() method algorithm.
Depends on #337
Preview | Diff