Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove sequential filling overload of constant() #656

Merged
merged 1 commit into from
Apr 27, 2024
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
34 changes: 0 additions & 34 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1343,40 +1343,6 @@ Data truncation will occur when the specified value exceeds the range of the spe
1. Return |operand|.
</details>

#### {{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.

<div class="note">
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.
</div>

<div>
**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))`.
</div>

<details open algorithm>
<summary>
The <dfn method for=MLGraphBuilder>constant(|start|, |end|, |step|, |type|)</dfn> method steps are:
</summary>
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|.
</details>

### build method ### {#api-mlgraphbuilder-build}
Build a composed graph up to a given output operand into a computational graph asynchronously.

Expand Down