Skip to content

Commit db1e51c

Browse files
authored
Specify element count limit (#926)
1 parent a4a7eb6 commit db1e51c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

index.bs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1697,6 +1697,16 @@ An {{MLOperandDescriptor}} |A| is <dfn for=MLOperandDescriptor>equal</dfn> to an
16971697
1. Return |elementLength| * |elementSize|.
16981698
</details>
16991699

1700+
<details open algorithm>
1701+
<summary>
1702+
The <dfn for="MLOperandDescriptor">element count</dfn> of an {{MLOperandDescriptor}} |desc| is the value returned by the following steps:
1703+
</summary>
1704+
1. Let |elementCount| be 1.
1705+
1. [=list/For each=] |dimension| of |desc|.{{MLOperandDescriptor/shape}}:
1706+
1. Set |elementCount| to |elementCount| * |dimension|.
1707+
1. Return |elementCount|.
1708+
</details>
1709+
17001710
<p>
17011711
A <dfn>valid dimension</dfn> is an integer greater than zero and in the range of {{long}}. Implementations may impose a smaller upper bound.
17021712
</p>
@@ -1712,6 +1722,7 @@ Issue(391): Should 0-size dimensions be supported?
17121722

17131723
Issue(456): The maximum number of operand dimensions is not defined, but native ML APIs usually have a maximum supported size.
17141724

1725+
1. If |descriptor|'s [=MLOperandDescriptor/element count=] is not a [=valid dimension=], then return false.
17151726
1. If |descriptor|'s [=MLOperandDescriptor/byte length=] is not supported by the implementation, then return false.
17161727
1. Return true.
17171728
</details>

0 commit comments

Comments
 (0)