Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 47 additions & 1 deletion index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -739,6 +739,11 @@ interface MLOperand {};
</dl>
</div>

To get the <dfn for="MLOperand">rank</dfn> of an {{MLOperand}} |operand|, run the following steps:
<div algorithm=rank class=algorithm-steps>
1. Return the size of |operand|.{{MLOperand/[[descriptor]]}}.{{MLOperandDescriptor/dimensions}}.
</div>

Since the {{MLOperand/[[builder]]}} object is bound by the {{MLGraphBuilder/constructor()}} constructor to an {{MLContext}} object, an {{MLOperand}} is also always bound to the same {{MLContext}} object.

#### Creating {{MLOperand}} #### {#api-mloperand-create}
Expand All @@ -763,6 +768,16 @@ To <dfn>check dimensions</dfn> given |dimensions| and |type|, run the following
1. Return `true`.
</div>

To <dfn for="MLOperand">validate MLOperand</dfn> given |operand| and |builder|, run the following steps:
<div class=algorithm-steps>
1. If |operand|.{{MLOperand/[[builder]]}} is not an instance of {{MLGraphBuilder}}, return `false`.
1. If |builder| is not `undefined` and is not equal to |operand|.{{MLOperand/[[builder]]}}, return `false`.
1. Let |desc| be |operand|.{{MLOperand/[[descriptor]]}}.
1. If |desc| is not an [=object=] that [=implements=] {{MLOperandDescriptor}}, return `false`.
1. If |desc|.{{MLOperandDescriptor/dimensions}} [=map/exists=] and invoking <a>check dimensions</a> given |desc|.{{MLOperandDescriptor/dimensions}} and |desc|.{{MLOperandDescriptor/type}} returns `false`, then return `false`.
1. Return `true`.
</div>

### The MLActivation interface ### {#api-mlactivation}

Objects implementing the {{MLActivation}} interface represent activation function types.
Expand Down Expand Up @@ -1418,7 +1433,7 @@ partial interface MLGraphBuilder {
MLOperand concat(sequence<MLOperand> inputs, unsigned long axis);
};
</script>
<div algorithm=concat>
<div>
**Arguments:**
- *inputs*: a sequence of {{MLOperand}}. All input tensors must have the
same shape, except for the size of the dimension to concatenate on.
Expand All @@ -1429,6 +1444,37 @@ partial interface MLGraphBuilder {
that all the inputs concatenated along. The size of that dimension is
computed as the sum of all the input sizes of the same dimension.
</div>
<div algorithm=concat>
The {{MLGraphBuilder/concat(inputs, axis)}} steps are:
<div class="note">
The permissions and context validity have been checked by [[#api-mlgraphbuilder-constructor]] steps.
</div>
1. Let |inputs| be the first argument.
1. [=Assert=]: the type of |inputs| is sequence of {{MLOperand}} objects.
1. [=Assert=]: the type of |axis| is `unsigned long`.
1. [=Assert=]: the shape, i.e. {{MLOperandDescriptor/dimensions}}) of each operand in |inputs| is the same, except on the dimension given by |axis| on which they are concatenated.
1. [=Assert=]: the {{MLOperandDescriptor/type}} of each operand in |inputs| is the same.
1. If any of the following steps fail, then throw a "{{DataError}}" {{DOMException}} and stop.
1. If |inputs| is not an array of [=objects=], fail.
1. If |axis| is not a positive integer [=number=], fail.
1. If |axis| is greater than or equal to the <a>rank</a> of |inputs|, fail.
1. Let |desc| be |inputs|[0].{{MLOperand/[[descriptor]]}}.
1. Let |desc|.{{MLOperandDescriptor/dimensions}}[|axis|] be `0`.
1. For each |index| between 0 and the <a>rank</a> of |inputs|:
1. If running <a>validate MLOperand</a> given |inputs|[|index|] and [=this=] returns `false`, then fail.
1. For each |dim| between 0 and the <a>rank</a> of |inputs|[|index|]:
<div class="note">
If the shape of each corresponding dimension and type of the operands, except for those of the dimension given by |axis|, is not the same, fail.
</div>
1. If |dim| is not equal to |axis| and if |inputs|[|index|].{{MLOperandDescriptor/dimensions}}[|dim|] is not equal to |inputs|[0].{{MLOperandDescriptor/dimensions}}[|dim|], fail.
1. If |inputs|[|dim|].{{MLOperandDescriptor/type}} is not equal to |inputs|[0].{{MLOperandDescriptor/type}}.
1. If |dim| is equal to |axis|, add to |desc|.{{MLOperandDescriptor/dimensions}}[|axis|] the value of |inputs|[|index|].{{MLOperandDescriptor/dimensions}}[|dim|].
1. Let |output| be the result of invoking the <a>create MLOperand</a> steps given [=this=] and |desc|.
1. If that throws an error, re-throw the error and stop.
1. Make a request to the underlying platform to create an operator for this method with |inputs| connected as input and |output| connected as output and store a reference to the [=implementation-defined=] platform object to |output|.{{MLOperand/[[operand]]}}.
1. If that fails, throw a "{{DataError}}" {{DOMException}} and stop.
1. Return |output|.
</div>

### The conv2d() method ### {#api-mlgraphbuilder-conv2d}
Compute a 2-D convolution given 4-D input and filter tensors
Expand Down