Skip to content

Commit b1b82c1

Browse files
committed
Gather example fixes
1 parent 7ded300 commit b1b82c1

File tree

1 file changed

+35
-12
lines changed

1 file changed

+35
-12
lines changed

index.bs

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4243,21 +4243,16 @@ partial dictionary MLOpSupportLimits {
42434243
{shape: [4, 3]},
42444244
new Float32Array([0, 1, 2, 10, 11, 12, 20, 21, 22, 30, 31, 32]));
42454245

4246-
const indices1 =
4247-
builder.constant({dataType: 'uint32', shape: [2]}, new Uint32Array([3, 1]));
4248-
4249-
const indices2 = builder.constant(
4250-
{dataType: 'uint32', shape: [3]}, new Uint32Array([2, 1, 1]));
4251-
4252-
const indices3 = builder.constant(
4253-
{dataType: 'uint32', shape: [2, 2]}, new Uint32Array([0, 1, 1, 2]));
4254-
42554246
// axis = 0 (default)
42564247
// indices of shape [2]:
42574248
// [3,1]
42584249
// output of shape [2,3]:
42594250
// [[30, 31, 32],
42604251
// [10, 11, 12]]
4252+
4253+
const indices1 =
4254+
builder.constant({dataType: 'uint32', shape: [2]}, new Uint32Array([3, 1]));
4255+
42614256
const output1 = builder.gather(input, indices1);
42624257

42634258
// axis = 1
@@ -4268,6 +4263,10 @@ partial dictionary MLOpSupportLimits {
42684263
// [12, 11, 11],
42694264
// [22, 21, 21],
42704265
// [32, 31, 31]]
4266+
4267+
const indices2 = builder.constant(
4268+
{dataType: 'uint32', shape: [3]}, new Uint32Array([2, 1, 1]));
4269+
42714270
const output2 = builder.gather(input, indices2, {axis: 1});
42724271

42734272
// axis = 1
@@ -4279,6 +4278,10 @@ partial dictionary MLOpSupportLimits {
42794278
// [[10, 11], [11, 12]],
42804279
// [[20, 21], [21, 22]],
42814280
// [[30, 31], [31, 32]]]
4281+
4282+
const indices3 = builder.constant(
4283+
{dataType: 'uint32', shape: [2, 2]}, new Uint32Array([0, 1, 1, 2]));
4284+
42824285
const output3 = builder.gather(input, indices3, {axis: 1});
42834286
</pre>
42844287
</details>
@@ -4406,7 +4409,7 @@ partial dictionary MLOpSupportLimits {
44064409
// [0],
44074410
// [2]],
44084411
// axis = 1
4409-
// output of shape [4,3]:
4412+
// output of shape [4,1]:
44104413
// [[ 2],
44114414
// [11],
44124415
// [20],
@@ -4430,7 +4433,7 @@ partial dictionary MLOpSupportLimits {
44304433
// indices of shape [1,2,2]:
44314434
// [[[0, 2],
44324435
// [1, 3]]],
4433-
// axis = 2
4436+
// axis = 0
44344437
// output of shape [1,2,2]:
44354438
// [[[ 0, 201],
44364439
// [110, 311]]]
@@ -4600,7 +4603,27 @@ partial dictionary MLOpSupportLimits {
46004603
{dataType: 'uint32', shape: [3, 1]},
46014604
new Uint32Array([1, 0, 1]));
46024605

4603-
const output3 = builder.gatherNd(input2, indices4);
4606+
const output4 = builder.gatherNd(input2, indices4);
4607+
4608+
// input of shape [2,2,2]:
4609+
// [[[0, 1],
4610+
// [2, 3]],
4611+
// [[4, 5],
4612+
// [6, 7]]]
4613+
// indices of shape [5,3]:
4614+
// [[0,0,1],
4615+
// [0,1,0],
4616+
// [1,0,0],
4617+
// [1,1,0],
4618+
// [1,1,1]]
4619+
// output of shape [5]:
4620+
// [1,2,4,6,7]
4621+
4622+
const indices5 = builder.constant(
4623+
{dataType: 'uint32', shape: [5, 3]},
4624+
new Uint32Array([0,0,1, 0,1,0, 1,0,0, 1,1,0, 1,1,1]));
4625+
4626+
const output5 = builder.gatherNd(input2, indices5);
46044627
</pre>
46054628
</details>
46064629
</div>

0 commit comments

Comments
 (0)