diff --git a/index.bs b/index.bs index 4e934f54..c126c7a9 100644 --- a/index.bs +++ b/index.bs @@ -1343,40 +1343,6 @@ Data truncation will occur when the specified value exceeds the range of the spe 1. Return |operand|. -#### {{MLGraphBuilder/constant(start, end, step, type)}} #### {#api-mlgraphbuilder-constant-range} -Create a constant {{MLOperand}} of the specified data type and shape that contains the data as specified by the range. - -
-Data truncation will occur when the values in the range exceed the range of the specified output data type e.g. when a float value is assigned to an {{MLOperandDataType/"int8"}} data type, etc. -
- -
- **Arguments:** - - *start*: a {{float}} scalar. The starting value of the range. - - *end*: a {{float}} scalar. The ending value of the range. - - *step*: a {{float}} scalar. The gap value between two data points in the range. - - *type*: an optional {{MLOperandDataType}}. If not specified, it is assumed to be {{MLOperandDataType/"float32"}}. - **Returns:** an {{MLOperand}}. The constant 1-D output tensor of size `max(0, ceil((end - start)/step))`. -
- -
- - The constant(|start|, |end|, |step|, |type|) method steps are: - - 1. Let |descriptor| be a new {{MLOperandDescriptor}}. - 1. Set |descriptor|.{{MLOperandDescriptor/dataType}} to |type|. - 1. Let |size| be max(0, ceil((|end| - |start|)/|step|)). - 1. If |size| is not a [=valid dimension=], then [=exception/throw=] a {{TypeError}}. - 1. Set |descriptor|.{{MLOperandDescriptor/dimensions}} to the [=/list=] « |size| ». - 1. *Make graph connections:* - 1. Let |operand| be the result of [=creating an MLOperand=] given [=this=] and |descriptor|. - 1. Let |buffer| be an [=implementation-defined=] platform memory buffer the size of |size| multiplied by sizeof(|descriptor|.{{MLOperandDescriptor/dataType}}). - 1. [=list/For each=] |index| in [=the range=] 0 to |size|, exclusive: - 1. Set |buffer|[|index|] to |start| + (|index| * |step|). - 1. Add |operand| to [=this=]'s [=MLGraphBuilder/graph=]'s [=computational graph/constants=] with |buffer| as value. - 1. Return |operand|. -
- ### build method ### {#api-mlgraphbuilder-build} Build a composed graph up to a given output operand into a computational graph asynchronously.