Skip to content

Commit 433aeee

Browse files
Fix unidirectionally broadcast the shapes steps (#663)
SHA: 4eda710 Reason: push, by fdwr Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent ee9d808 commit 433aeee

1 file changed

Lines changed: 13 additions & 13 deletions

File tree

index.html

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<link href="https://www.w3.org/StyleSheets/TR/2021/W3C-ED" rel="stylesheet">
88
<meta content="Bikeshed version 82ce88815, updated Thu Sep 7 16:33:55 2023 -0700" name="generator">
99
<link href="https://www.w3.org/TR/webnn/" rel="canonical">
10-
<meta content="f133ff02d22389af2dc947154309fed244684327" name="document-revision">
10+
<meta content="4eda710f32457b119a4fc74d5dd4016818079ec1" name="document-revision">
1111
<style>
1212
/* Make <dl> blocks more distinct from their surroundings. */
1313
main dl:not(.switch) {
@@ -8135,37 +8135,37 @@ <h2 class="heading settled" data-level="8" id="algorithms"><span class="secno">8
81358135
<h3 class="heading settled" data-level="8.1" id="algorithms-broadcasting"><span class="secno">8.1. </span><span class="content">Broadcasting</span><a class="self-link" href="#algorithms-broadcasting"></a></h3>
81368136
<p>Broadcasting refers to how operations treat tensors with different shapes, and follow the precedent set by <a data-link-type="biblio" href="#biblio-numpy-broadcasting-rule" title="General Broadcasting Rules of NumPy">[numpy-broadcasting-rule]</a>.</p>
81378137
<details class="algorithm" data-algorithm="unidirectionally broadcasting the shapes" open>
8138-
<summary> To <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="unidirectionally broadcasting the shapes" data-noexport id="unidirectionally-broadcasting-the-shapes">unidirectionally broadcast the shapes</dfn> <var>shapeA</var> and <var>shapeB</var>, perform the following steps. <var>shapeA</var> and <var>shapeB</var> are <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list" id="ref-for-list⑤③">lists</a> of positive integers, representing the dimensions of tensors, and the steps return a new <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list" id="ref-for-list⑤④">list</a> of positive integers, or failure. </summary>
8138+
<summary> To <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="unidirectionally broadcasting the shapes" data-noexport id="unidirectionally-broadcasting-the-shapes">unidirectionally broadcast the shapes</dfn> <var>shapeFrom</var> and <var>shapeTo</var>, perform the following steps. <var>shapeFrom</var> and <var>shapeTo</var> are <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list" id="ref-for-list⑤③">lists</a> of positive integers, representing the dimensions of tensors, and the steps return a new <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list" id="ref-for-list⑤④">list</a> of positive integers, or failure. </summary>
81398139
<ol>
81408140
<li data-md>
8141-
<p>Let <var>sizeA</var> be <var>shapeA</var>’s <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-size" id="ref-for-list-size④⑥">size</a>.</p>
8141+
<p>Let <var>sizeFrom</var> be <var>shapeFrom</var>’s <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-size" id="ref-for-list-size④⑥">size</a>.</p>
81428142
<li data-md>
8143-
<p>Let <var>sizeB</var> be <var>shapeB</var>’s <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-size" id="ref-for-list-size④⑦">size</a>.</p>
8143+
<p>Let <var>sizeTo</var> be <var>shapeTo</var>’s <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-size" id="ref-for-list-size④⑦">size</a>.</p>
81448144
<li data-md>
8145-
<p>If <var>sizeB</var> > <var>sizeA</var>, then return failure.</p>
8145+
<p>If <var>sizeFrom</var> > <var>sizeTo</var>, then return failure.</p>
81468146
<li data-md>
8147-
<p>Let <var>paddedB</var> be a <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-clone" id="ref-for-list-clone⑨">clone</a> of <var>shapeB</var>.</p>
8147+
<p>Let <var>paddedShapeFrom</var> be a <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-clone" id="ref-for-list-clone⑨">clone</a> of <var>shapeFrom</var>.</p>
81488148
<li data-md>
8149-
<p>While <var>paddedB</var>’s <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-size" id="ref-for-list-size④⑧">size</a> is less than <var>sizeA</var>, <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-prepend" id="ref-for-list-prepend">prepend</a> 1 to <var>paddedB</var>.</p>
8149+
<p>While <var>paddedShapeFrom</var>’s <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-size" id="ref-for-list-size④⑧">size</a> is less than <var>sizeTo</var>, <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-prepend" id="ref-for-list-prepend">prepend</a> 1 to <var>paddedShapeFrom</var>.</p>
81508150
<li data-md>
81518151
<p>Let <var>outputShape</var> be a new <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list" id="ref-for-list⑤⑤">list</a>.</p>
81528152
<li data-md>
8153-
<p><a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-iterate" id="ref-for-list-iterate①⑤">For each</a> <var>index</var> in <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#the-range" id="ref-for-the-range①④">the range</a> 0 to <var>sizeA</var>, exclusive:</p>
8153+
<p><a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-iterate" id="ref-for-list-iterate①⑤">For each</a> <var>index</var> in <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#the-range" id="ref-for-the-range①④">the range</a> 0 to <var>sizeTo</var>, exclusive:</p>
81548154
<ol>
81558155
<li data-md>
8156-
<p>Let <var>dimA</var> be <var>shapeA</var>[<var>index</var>].</p>
8156+
<p>Let <var>dimFrom</var> be <var>paddedShapeFrom</var>[<var>index</var>].</p>
81578157
<li data-md>
8158-
<p>Let <var>dimB</var> be <var>paddedB</var>[<var>index</var>].</p>
8158+
<p>Let <var>dimTo</var> be <var>shapeTo</var>[<var>index</var>].</p>
81598159
<li data-md>
8160-
<p>If <var>dimA</var> is not equal to <var>dimB</var> and <var>dimA</var> is not equal to 1, then return failure.</p>
8160+
<p>If <var>dimTo</var> is not equal to <var>dimFrom</var> and <var>dimFrom</var> is not equal to 1, then return failure.</p>
81618161
<li data-md>
8162-
<p><a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-append" id="ref-for-list-append③">Append</a> <var>dimA</var> to <var>outputShape</var>.</p>
8162+
<p><a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-append" id="ref-for-list-append③">Append</a> <var>dimTo</var> to <var>outputShape</var>.</p>
81638163
</ol>
81648164
<li data-md>
81658165
<p>Return <var>outputShape</var>.</p>
81668166
</ol>
81678167
</details>
8168-
<p class="algorithm" data-algorithm="unidirectionally broadcastable"> <var>shapeA</var> is <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="unidirectionally-broadcastable">unidirectionally broadcastable</dfn> to <var>shapeB</var> if <a data-link-type="dfn" href="#unidirectionally-broadcasting-the-shapes" id="ref-for-unidirectionally-broadcasting-the-shapes②">unidirectionally broadcasting the shapes</a> <var>shapeA</var> and <var>shapeB</var> does not result in failure. </p>
8168+
<p class="algorithm" data-algorithm="unidirectionally broadcastable"> <var>shapeFrom</var> is <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="unidirectionally-broadcastable">unidirectionally broadcastable</dfn> to <var>shapeTo</var> if <a data-link-type="dfn" href="#unidirectionally-broadcasting-the-shapes" id="ref-for-unidirectionally-broadcasting-the-shapes②">unidirectionally broadcasting the shapes</a> <var>shapeFrom</var> and <var>shapeTo</var> does not result in failure. </p>
81698169
<details class="algorithm" data-algorithm="bidirectionally broadcasting the shapes" open>
81708170
<summary> To <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="bidirectionally broadcasting the shapes" data-noexport id="bidirectionally-broadcasting-the-shapes">bidirectionally broadcast the shapes</dfn> <var>shapeA</var> and <var>shapeB</var>, perform the following steps. <var>shapeA</var> and <var>shapeB</var> are <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list" id="ref-for-list⑤⑥">lists</a> of positive integers, representing the dimensions of tensors, and the steps return a new <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list" id="ref-for-list⑤⑦">list</a> of positive integers, or failure. </summary>
81718171
<ol>

0 commit comments

Comments
 (0)