You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -1224,6 +1224,33 @@ The [=new=] {{MLGraphBuilder}} constructor steps are:
1224
1224
1. If the <a>validate MLContext</a> steps given |context| return `false`, throw a "{{TypeError}}" and abort these steps.
1225
1225
1. Set {{MLGraphBuilder/[[context]]}} to |context|.
1226
1226
1227
+
### The {{MLGraphBuilder/input()}} method ### {#api-mlgraphbuilder-input}
1228
+
Create a named {{MLOperand}} based on a descriptor, that can be used as an input.
1229
+
<div class="note">
1230
+
**Arguments:**
1231
+
- *name*: a [=string=] name of the input.
1232
+
- *descriptor*: an {{MLOperandDescriptor}} object.
1233
+
**Returns:**: an {{MLOperand}} object.
1234
+
</div>
1235
+
<div algorithm=input>
1236
+
The {{MLGraphBuilder/input(name, descriptor)}} steps are:
1237
+
<div class="note">
1238
+
The permissions and context validity have been checked by [[#api-mlgraphbuilder-constructor]] steps.
1239
+
</div>
1240
+
1. Let |name| be the first argument.
1241
+
1. If |name| is `undefined` or an empty [=string=], then throw a "{{TypeError}}" {{DOMException}} and stop.
1242
+
1. Let |descriptor| be the second argument.
1243
+
1. If |descriptor| is not an an object that [=implements=]{{MLOperandDescriptor}}, then throw a "{{TypeError}}" {{DOMException}} and stop.
1244
+
1. [=Assert=]: If |descriptor|.{{MLOperandDescriptor/dimensions}} does not [=map/exist=], then |descriptor| defines a scalar input.
1245
+
1. If |descriptor|.{{MLOperandDescriptor/dimensions}}[=map/exists=]:
1246
+
1. If the [=check dimensions=] steps given |descriptor|.{{MLOperandDescriptor/type}} and |descriptor|.{{MLOperandDescriptor/dimensions}} return `false`, throw a "{{DataError}}" {{DOMException}} and stop.
1247
+
1. If the [=byte length=] of |descriptor| is not supported by the underlying platform, then throw a "{{DataError}}" {{DOMException}} and stop.
1248
+
1. Let |operand| be the result of invoking the <a>create MLOperand</a> steps with [=this=], `"input"` and |descriptor|.
1249
+
1. If that throws, re-throw the exception and stop.
1250
+
1. Set |operand|.{{MLOperand/[[name]]}} to |name|.
1251
+
1. Make a request to the underlying platform to register |operand| as an input and store a reference to the corresponding [=implementation-defined=] platform object in |operand|.{{MLOperand/[[operand]]}}.
1252
+
1. If that fails, throw an "{{OperationError}}" {{DOMException}} and abort these steps.
1253
+
1227
1254
### The constant() method ### {#api-mlgraphbuilder-constant-method}
1228
1255
Create a constant {{MLOperand}} that can be used in {{MLGraphBuilder}} methods.
0 commit comments