diff --git a/index.bs b/index.bs index 14778685..6e7fe0e0 100644 --- a/index.bs +++ b/index.bs @@ -739,6 +739,11 @@ interface MLOperand {}; +To get the rank of an {{MLOperand}} |operand|, run the following steps: +
+ 1. Return the size of |operand|.{{MLOperand/[[descriptor]]}}.{{MLOperandDescriptor/dimensions}}. +
+ 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} @@ -763,6 +768,16 @@ To check dimensions given |dimensions| and |type|, run the following 1. Return `true`. +To validate MLOperand given |operand| and |builder|, run the following 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 check dimensions given |desc|.{{MLOperandDescriptor/dimensions}} and |desc|.{{MLOperandDescriptor/type}} returns `false`, then return `false`. + 1. Return `true`. +
+ ### The MLActivation interface ### {#api-mlactivation} Objects implementing the {{MLActivation}} interface represent activation function types. @@ -1418,7 +1433,7 @@ partial interface MLGraphBuilder { MLOperand concat(sequence inputs, unsigned long axis); }; -
+
**Arguments:** - *inputs*: a sequence of {{MLOperand}}. All input tensors must have the same shape, except for the size of the dimension to concatenate on. @@ -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.
+
+ The {{MLGraphBuilder/concat(inputs, axis)}} steps are: +
+ The permissions and context validity have been checked by [[#api-mlgraphbuilder-constructor]] steps. +
+ 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 rank 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 rank of |inputs|: + 1. If running validate MLOperand given |inputs|[|index|] and [=this=] returns `false`, then fail. + 1. For each |dim| between 0 and the rank of |inputs|[|index|]: +
+ 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. +
+ 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 create MLOperand 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|. +
### The conv2d() method ### {#api-mlgraphbuilder-conv2d} Compute a 2-D convolution given 4-D input and filter tensors