@genai-fi/nanogpt 1.1.1 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,13 +4,13 @@ import { A as zn, C as Bn, D as Vn, E as Hn, F as Un, I as Wn, M as Gn, N as Kn,
4
4
  import { a as sr, o as cr, r as lr, t as ur } from "./slice_util-Dve4TkDn.js";
5
5
  import { n as dr, t as fr } from "./concat_util-CWzvQQlK.js";
6
6
  import { t as pr } from "./shared-24EoeHJl.js";
7
- import { a as mr, d as P, i as F, o as hr, r as gr, s as I, t as _r, u as L } from "./webgpu_program-B0PokuRJ.js";
8
- import { a as vr, c as R, i as z, l as yr, n as B, o as br, r as xr, s as Sr } from "./webgpu_util-DfODg6XI.js";
9
- import { t as Cr } from "./webgpu-B19Tw8Nd.js";
7
+ import { a as mr, c as P, i as F, l as hr, n as I, o as gr, r as _r, s as vr } from "./webgpu_util-DfODg6XI.js";
8
+ import { t as yr } from "./webgpu-IAn9VotJ.js";
9
+ import { a as br, d as L, i as R, o as xr, r as Sr, s as z, t as Cr, u as B } from "./webgpu_program-B0PokuRJ.js";
10
10
  import { n as wr, t as V } from "./binary_op_util-CrYk9LXL.js";
11
11
  import { n as Tr, t as H } from "./Reshape-CwxdaU8n.js";
12
12
  //#region node_modules/@tensorflow/tfjs-backend-webgpu/dist/base.js
13
- yr() && Kt("webgpu", async () => {
13
+ hr() && Kt("webgpu", async () => {
14
14
  let e = { powerPreference: A().get("WEBGPU_USE_LOW_POWER_GPU") ? "low-power" : "high-performance" }, t = await navigator.gpu.requestAdapter(e), n = {}, r = [];
15
15
  t.features.has("timestamp-query") && r.push("timestamp-query"), t.features.has("bgra8unorm-storage") && r.push(["bgra8unorm-storage"]), t.features.has("subgroups") && r.push("subgroups"), n.requiredFeatures = r;
16
16
  let i = t.limits;
@@ -21,7 +21,7 @@ yr() && Kt("webgpu", async () => {
21
21
  maxBufferSize: i.maxBufferSize,
22
22
  maxComputeWorkgroupSizeX: i.maxComputeWorkgroupSizeX,
23
23
  maxComputeInvocationsPerWorkgroup: i.maxComputeInvocationsPerWorkgroup
24
- }, new Cr(await t.requestDevice(n), "info" in t ? t.info : "requestAdapterInfo" in t ? await t.requestAdapterInfo() : void 0);
24
+ }, new yr(await t.requestDevice(n), "info" in t ? t.info : "requestAdapterInfo" in t ? await t.requestAdapterInfo() : void 0);
25
25
  }, 3);
26
26
  //#endregion
27
27
  //#region node_modules/@tensorflow/tfjs-backend-webgpu/dist/unary_op_util.js
@@ -110,7 +110,7 @@ function G(e, t = !1, n = !1, r = 3) {
110
110
  else if (e === "sigmoid") i = W(U.SIGMOID, n);
111
111
  else if (e === "leakyrelu") i = W(U.LEAKYRELU, n);
112
112
  else throw Error(`Activation ${e} has not been implemented for the WebGPU backend.`);
113
- let a = L(n ? 4 : 1), o = "";
113
+ let a = B(n ? 4 : 1), o = "";
114
114
  return o = t ? `
115
115
  fn activation(a : ${a}, coords : vec${r}<i32>) -> ${a} {
116
116
  let b = getPreluActivationWeightsByOutputCoords(coords);
@@ -135,8 +135,8 @@ function _i(e, t, n = !1, r = !1, i = !1, a = 1) {
135
135
 
136
136
  `, s = t ? "value = getB(batch, col, row);" : "value = getB(batch, row, col);";
137
137
  return `
138
- fn mm_readA(batch: i32, row: i32, col: i32) -> ${L(a)} {
139
- var value = ${L(a)}(0.0);
138
+ fn mm_readA(batch: i32, row: i32, col: i32) -> ${B(a)} {
139
+ var value = ${B(a)}(0.0);
140
140
  ${n && i ? o : `
141
141
  ${e ? "if(row < uniforms.dimAOuter && col < uniforms.dimInner)" : "if(row < uniforms.aShape[1] && col < uniforms.aShape[2])"}
142
142
  {
@@ -146,8 +146,8 @@ function _i(e, t, n = !1, r = !1, i = !1, a = 1) {
146
146
  return value;
147
147
  }
148
148
 
149
- fn mm_readB(batch: i32, row: i32, col: i32) -> ${L(a)} {
150
- var value = ${L(a)}(0.0);
149
+ fn mm_readB(batch: i32, row: i32, col: i32) -> ${B(a)} {
150
+ var value = ${B(a)}(0.0);
151
151
  ${s}
152
152
  return value;
153
153
  }
@@ -156,7 +156,7 @@ function _i(e, t, n = !1, r = !1, i = !1, a = 1) {
156
156
  function vi(e, t, n, r, i = !1, a = !1, o = !1, s = 1) {
157
157
  return `
158
158
  ${_i(n, r, i, a, o, s)}
159
- fn mm_write(batch: i32, row: i32, col: i32, valueIn: ${L(s)}) {
159
+ fn mm_write(batch: i32, row: i32, col: i32, valueIn: ${B(s)}) {
160
160
  ${i && a ? "" : "if (row < uniforms.dimAOuter && col < uniforms.dimBOuter)"}
161
161
  {
162
162
  var value = valueIn;
@@ -205,7 +205,7 @@ function xi(e, t, n = !1, r = 32, i = !1, a = 32, o = !1) {
205
205
  var<workgroup> mm_Asub : array<array<vec${d}<f32>, ${l / d}>, ${u}>;
206
206
  var<workgroup> mm_Bsub : array<array<vec4<f32>, ${c / e[0]}>, ${r}>;
207
207
 
208
- ${I()} {
208
+ ${z()} {
209
209
  let localRow = i32(localId.y);
210
210
  let tileRow = localRow * ${p};
211
211
  let tileCol = i32(localId.x);
@@ -368,7 +368,7 @@ function wi(e, t, n = !1, r = 32, i = !1, a = 32, o = !1, s = !1) {
368
368
  var<workgroup> mm_Asub : array<array<f32, ${u}>, ${d}>;
369
369
  var<workgroup> mm_Bsub : array<array<f32, ${l}>, ${r}>;
370
370
 
371
- ${I()} {
371
+ ${z()} {
372
372
  let batch = ${i ? "0" : "i32(globalId.z)"};
373
373
  let batchA = ${i || !s ? "batch" : "batch % uniforms.aShape[0]"};
374
374
  let batchB = ${i || !s ? "batch" : "batch % uniforms.bShape[0]"};
@@ -394,7 +394,7 @@ function Ei(e, t = !1) {
394
394
  return `
395
395
  var<workgroup> mm_Asub : array<vec4<f32>, ${e[0]}>;
396
396
 
397
- ${I()} {
397
+ ${z()} {
398
398
  let tileCol = i32(localId.x);
399
399
  let globalCol = i32(globalId.x);
400
400
  let globalRow = i32(globalId.y);
@@ -450,10 +450,10 @@ var Di = class {
450
450
  1
451
451
  ];
452
452
  else {
453
- let e = br(t[1], c, t[2], n);
453
+ let e = gr(t[1], c, t[2], n);
454
454
  this.workgroupSize = e.workgroupSize, this.elementsPerThread = e.elementsPerThread;
455
455
  }
456
- this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize, this.elementsPerThread);
456
+ this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize, this.elementsPerThread);
457
457
  let l = i != null, u = o != null;
458
458
  l && this.variableNames.push("bias"), u && this.variableNames.push("preluActivationWeights"), this.sequentialAccessByThreads = s, this.transposeA = n, this.transposeB = r, this.addBias = l, this.activation = a, this.hasPreluActivationWeights = u, [this.fitAOuter, this.fitBOuter, this.fitInner] = this.getShapeFit(t[1], t[2], c), this.shaderKey = `matMulPacked_${this.elementsPerThread}_${n}_${r}_${this.activation}_${this.fitAOuter}_${this.fitBOuter}_${this.fitInner}_${this.isVec4}_${this.isVectorA}_${this.sequentialAccessByThreads}`;
459
459
  }
@@ -478,7 +478,7 @@ var Di = class {
478
478
  function Oi(e) {
479
479
  return `
480
480
  var<workgroup> sumValues : array<f32, ${e}>;
481
- ${I()} {
481
+ ${z()} {
482
482
  let coords = getOutputCoords();
483
483
  let batch = coords[0];
484
484
  let batchA = batch % uniforms.aShape[0];
@@ -521,7 +521,7 @@ var ki = class {
521
521
  x: [],
522
522
  y: [1, 2],
523
523
  z: [0]
524
- }, this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize);
524
+ }, this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize);
525
525
  let o = r != null, s = a != null;
526
526
  o && this.variableNames.push("bias"), s && this.variableNames.push("preluActivationWeights"), this.transposeA = t, this.transposeB = n, this.addBias = o, this.activation = i, this.hasPreluActivationWeights = s, this.shaderKey = `matMulReduce_${this.activation}_${t}_${n}`;
527
527
  }
@@ -547,7 +547,7 @@ function Ai(e) {
547
547
  // shared memory, so it is instruction-Level parallelism for arithmetic
548
548
  // operations and others handle IO operations between barrier api, makes ALU
549
549
  // and load/store units work simultaneously, could improves the performance.
550
- ${I()} {
550
+ ${z()} {
551
551
  let tileRow = i32(localId.y);
552
552
  let tileCol = i32(localId.x);
553
553
  let globalRow = i32(globalId.y);
@@ -634,7 +634,7 @@ var ji = class {
634
634
  4,
635
635
  4,
636
636
  this.splitedDimInner
637
- ], this.outputComponent = i ? 4 : 1, i || (this.outputShape[1] < 16 && (this.elementsPerThread[1] = 1), this.outputShape[2] < 16 && (this.elementsPerThread[0] = 1)), this.dispatch = z(this.dispatchLayout, [
637
+ ], this.outputComponent = i ? 4 : 1, i || (this.outputShape[1] < 16 && (this.elementsPerThread[1] = 1), this.outputShape[2] < 16 && (this.elementsPerThread[0] = 1)), this.dispatch = F(this.dispatchLayout, [
638
638
  this.outputShape[0],
639
639
  this.outputShape[1],
640
640
  this.outputShape[2],
@@ -645,14 +645,14 @@ var ji = class {
645
645
  let e = this.outputComponent;
646
646
  return `
647
647
  ${_i(!1, this.transposeB, !1, !1, !1, e)}
648
- fn mm_write(batch: i32, row : i32, col : i32, value : ${L(e)}) {
648
+ fn mm_write(batch: i32, row : i32, col : i32, value : ${B(e)}) {
649
649
  if (row < uniforms.dimAOuter && col < uniforms.dimBOuter) {
650
650
  let coords = vec3<i32>(batch, row, col);
651
651
  let flatIndex = getOutputIndexFromCoords(coords);
652
652
  // The problem is that we should initialize output to zero before using.
653
653
  // Otherwise, the original value will be added to the result.
654
654
  for (var i = 0; i < ${e}; i = i + 1) {
655
- ${P("&result[flatIndex + i]", `${e > 1 ? "value[i]" : "value"}`, "float32")}
655
+ ${L("&result[flatIndex + i]", `${e > 1 ? "value[i]" : "value"}`, "float32")}
656
656
  }
657
657
  }
658
658
  }
@@ -665,12 +665,12 @@ var ji = class {
665
665
  64,
666
666
  1,
667
667
  1
668
- ], this.size = !0, this.outputShape = e, this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize), this.addBias = t != null, this.hasPreluActivationWeights = r != null, this.activation = n, this.addBias && this.variableNames.push("bias"), this.hasPreluActivationWeights && this.variableNames.push("preluActivationWeights"), this.shaderKey = `biasActivation_${n}`;
668
+ ], this.size = !0, this.outputShape = e, this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize), this.addBias = t != null, this.hasPreluActivationWeights = r != null, this.activation = n, this.addBias && this.variableNames.push("bias"), this.hasPreluActivationWeights && this.variableNames.push("preluActivationWeights"), this.shaderKey = `biasActivation_${n}`;
669
669
  }
670
670
  getUserCode() {
671
671
  return `
672
672
  ${G(this.activation, this.hasPreluActivationWeights)}
673
- ${I("index")} {
673
+ ${z("index")} {
674
674
  if (index < uniforms.size) {
675
675
  let coords = getCoordsFromIndex(index);
676
676
  var value = getXByOutputIndex(index);
@@ -686,11 +686,11 @@ var ji = class {
686
686
  64,
687
687
  1,
688
688
  1
689
- ], this.size = !0, this.outputShape = e, this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize), this.shaderKey = "fill";
689
+ ], this.size = !0, this.outputShape = e, this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize), this.shaderKey = "fill";
690
690
  }
691
691
  getUserCode() {
692
692
  return `
693
- ${I("index")} {
693
+ ${z("index")} {
694
694
  if (index < uniforms.size) {
695
695
  setOutputAtIndex(index, uniforms.value);
696
696
  }
@@ -767,13 +767,13 @@ function Ii({ a: e, b: t, transposeA: n, transposeB: r, backend: i, bias: a = nu
767
767
  ], ne = A().get("WEBGPU_MATMUL_PROGRAM_TYPE");
768
768
  if (ne < 0) {
769
769
  let e = A().getNumber("WEBGPU_THRESHOLD_TO_INCREASE_WORKGROUPS_FOR_MATMUL"), t = e > 0 ? e : i.thresholdToIncreaseWorkgroups, n = T * Math.ceil(p / 32) * Math.ceil(m / 32);
770
- ne = n <= t || p <= 8 && n <= t * 2 ? T * p * m <= 128 ? B.MatMulReduceProgram : T === 1 && f >= 2e3 ? B.MatMulSplitKProgram : B.MatMulSmallOutputSizeProgram : B.MatMulPackedProgram;
770
+ ne = n <= t || p <= 8 && n <= t * 2 ? T * p * m <= 128 ? I.MatMulReduceProgram : T === 1 && f >= 2e3 ? I.MatMulSplitKProgram : I.MatMulSmallOutputSizeProgram : I.MatMulPackedProgram;
771
771
  }
772
772
  switch (ne) {
773
- case B.MatMulReduceProgram:
773
+ case I.MatMulReduceProgram:
774
774
  D = new ki(te, n, r, a, c, o);
775
775
  break;
776
- case B.MatMulSplitKProgram:
776
+ case I.MatMulSplitKProgram:
777
777
  if (O = q({
778
778
  backend: i,
779
779
  attrs: {
@@ -800,10 +800,10 @@ function Ii({ a: e, b: t, transposeA: n, transposeB: r, backend: i, bias: a = nu
800
800
  return u;
801
801
  }
802
802
  break;
803
- case B.MatMulSmallOutputSizeProgram:
803
+ case I.MatMulSmallOutputSizeProgram:
804
804
  D = new ji(b, x, te, n, r, a, c, o);
805
805
  break;
806
- case B.MatMulPackedProgram:
806
+ case I.MatMulPackedProgram:
807
807
  D = new Di(b, te, n, r, a, c, o, i.adapterInfo.isIntel());
808
808
  break;
809
809
  default: throw Error(`Unsupported MatMulProgramType ${ne}.`);
@@ -852,7 +852,7 @@ var Ri = {
852
852
  128,
853
853
  1,
854
854
  1
855
- ], this.size = !0, this.outputShape = k(t, n), this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize), this.shaderKey = `binaryOpComplex_${e}`, this.op = e;
855
+ ], this.size = !0, this.outputShape = k(t, n), this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize), this.shaderKey = `binaryOpComplex_${e}`, this.op = e;
856
856
  }
857
857
  getUserCode() {
858
858
  return `
@@ -861,7 +861,7 @@ var Ri = {
861
861
  ${wr(this.op, !1)}
862
862
  }
863
863
 
864
- ${I("index")} {
864
+ ${z("index")} {
865
865
  if(index < uniforms.size) {
866
866
  let areal = getARealByOutputIndex(index);
867
867
  let aimag = getAImagByOutputIndex(index);
@@ -874,7 +874,7 @@ var Ri = {
874
874
  }
875
875
  }, Bi = class {
876
876
  constructor(e, t, n) {
877
- if (this.size = !0, this.variableNames = ["A", "B"], this.outputShape = k(t, n), this.dispatchLayout = R(this.outputShape), this.op = e, this.useSharedMemoryWithA = t.length <= 1 && n.length > 1 && t[0] < 128, this.useSharedMemoryWithB = n.length <= 1 && t.length > 1 && n[0] < 128, this.useSharedMemoryWithA || this.useSharedMemoryWithB) this.outputComponent = 1, this.variableComponents = [1, 1], this.lastDimensionSize = this.useSharedMemoryWithB ? n[0] : t[0], this.shaderKey = `binary_${e}_${this.lastDimensionSize}`, this.type = "shared", this.workgroupSize = [
877
+ if (this.size = !0, this.variableNames = ["A", "B"], this.outputShape = k(t, n), this.dispatchLayout = P(this.outputShape), this.op = e, this.useSharedMemoryWithA = t.length <= 1 && n.length > 1 && t[0] < 128, this.useSharedMemoryWithB = n.length <= 1 && t.length > 1 && n[0] < 128, this.useSharedMemoryWithA || this.useSharedMemoryWithB) this.outputComponent = 1, this.variableComponents = [1, 1], this.lastDimensionSize = this.useSharedMemoryWithB ? n[0] : t[0], this.shaderKey = `binary_${e}_${this.lastDimensionSize}`, this.type = "shared", this.workgroupSize = [
878
878
  256,
879
879
  1,
880
880
  1
@@ -887,7 +887,7 @@ var Ri = {
887
887
  1
888
888
  ];
889
889
  }
890
- this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize, [
890
+ this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize, [
891
891
  this.outputComponent,
892
892
  1,
893
893
  1
@@ -906,7 +906,7 @@ var Ri = {
906
906
  e = `
907
907
  ${n}
908
908
  var<workgroup> sharedBuf : array<f32, ${this.lastDimensionSize}>;
909
- ${I("index")} {
909
+ ${z("index")} {
910
910
  // Fill in the shared memory buffer.
911
911
  let localIndex = i32(localId.x);
912
912
  if(localIndex < ${this.lastDimensionSize}) {
@@ -923,7 +923,7 @@ var Ri = {
923
923
  `;
924
924
  } else e = `
925
925
  ${n}
926
- ${I("index")} {
926
+ ${z("index")} {
927
927
  if (index < uniforms.size) {
928
928
  let coords = getCoordsFromIndex(index * ${this.outputComponent});
929
929
  let a = ${t}(getAByOutputCoords(coords));
@@ -975,14 +975,14 @@ var Hi = {
975
975
  128,
976
976
  1,
977
977
  1
978
- ], this.outputShape = e, this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize), this.op = t, n !== "" && (this.uniforms = n), this.shaderKey = `unary_${t}`;
978
+ ], this.outputShape = e, this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize), this.op = t, n !== "" && (this.uniforms = n), this.shaderKey = `unary_${t}`;
979
979
  }
980
980
  getUserCode() {
981
981
  return `
982
982
  fn unaryOperation(a : f32) -> f32 {
983
983
  ${W(this.op, !1)}
984
984
  }
985
- ${I("index")} {
985
+ ${z("index")} {
986
986
  if (index < uniforms.size) {
987
987
  let a = getAByOutputIndex(index);
988
988
  setOutputAtIndex(index, unaryOperation(a));
@@ -1095,7 +1095,7 @@ var { addImpl: Wi, castImpl: Gi, ceilImpl: Ki, concatImpl: qi, equalImpl: Ji, ex
1095
1095
  64,
1096
1096
  1,
1097
1097
  1
1098
- ], this.size = !0, this.outputShape = e[0], this.variableNames = e.map((e, t) => `T${t}`), this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize, [
1098
+ ], this.size = !0, this.outputShape = e[0], this.variableNames = e.map((e, t) => `T${t}`), this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize, [
1099
1099
  this.workPerThread,
1100
1100
  1,
1101
1101
  1
@@ -1108,7 +1108,7 @@ var { addImpl: Wi, castImpl: Gi, ceilImpl: Ki, concatImpl: qi, equalImpl: Ji, ex
1108
1108
  });
1109
1109
  let t = this.variableNames.map((e) => `v${e}`).join(" + ");
1110
1110
  return `
1111
- ${I("index")} {
1111
+ ${z("index")} {
1112
1112
  for (var i = 0; i < ${this.workPerThread}; i = i + 1) {
1113
1113
  let flatIndex = index * ${this.workPerThread} + i;
1114
1114
  if (flatIndex < uniforms.size) {
@@ -1148,7 +1148,7 @@ var ja = {
1148
1148
  this.outputShape = n, this.dispatchLayout = {
1149
1149
  x: [0],
1150
1150
  y: [1]
1151
- }, this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize, [
1151
+ }, this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize, [
1152
1152
  1,
1153
1153
  1,
1154
1154
  1
@@ -1159,7 +1159,7 @@ var ja = {
1159
1159
  let e = this.workgroupSize[0];
1160
1160
  return `
1161
1161
  var<workgroup> tile : array<array<f32, ${this.workgroupSize[0] + 1}>, ${this.workgroupSize[0]}>;
1162
- ${I()} {
1162
+ ${z()} {
1163
1163
  var x = i32(workgroupId.x) * ${e} + i32(localId.x);
1164
1164
  var y = i32(workgroupId.y) * ${e} + i32(localId.y);
1165
1165
  let width = uniforms.outShape[0];
@@ -1187,16 +1187,16 @@ var ja = {
1187
1187
  ], this.size = !0;
1188
1188
  let n = Array(e.length);
1189
1189
  for (let r = 0; r < n.length; r++) n[r] = e[t[r]];
1190
- this.outputShape = n, this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize, [
1190
+ this.outputShape = n, this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize, [
1191
1191
  this.workPerThread,
1192
1192
  1,
1193
1193
  1
1194
1194
  ]), this.newDim = t, this.shaderKey = `transpose_${t}`;
1195
1195
  }
1196
1196
  getUserCode() {
1197
- let e = F(this.outputShape.length), t = Pa(this.newDim);
1197
+ let e = R(this.outputShape.length), t = Pa(this.newDim);
1198
1198
  return `
1199
- ${I("index")} {
1199
+ ${z("index")} {
1200
1200
  for(var i = 0; i < ${this.workPerThread}; i = i + 1) {
1201
1201
  let flatIndex = index * ${this.workPerThread} + i;
1202
1202
  if(flatIndex < uniforms.size) {
@@ -1213,7 +1213,7 @@ function Pa(e) {
1213
1213
  let t = e.length;
1214
1214
  if (t > 6) throw Error(`Transpose for rank ${t} is not yet supported`);
1215
1215
  let n = Array(t);
1216
- for (let t = 0; t < e.length; t++) n[e[t]] = `coords.${hr(t)}`;
1216
+ for (let t = 0; t < e.length; t++) n[e[t]] = `coords.${xr(t)}`;
1217
1217
  return n.join();
1218
1218
  }
1219
1219
  //#endregion
@@ -1252,7 +1252,7 @@ var Fa = {
1252
1252
  64,
1253
1253
  1,
1254
1254
  1
1255
- ], this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, [
1255
+ ], this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, [
1256
1256
  1,
1257
1257
  1,
1258
1258
  1
@@ -1279,7 +1279,7 @@ var Fa = {
1279
1279
  let offset = ${this.outputShape.length === 1 ? "outputCoords" : "outputCoords[0]"} * uniforms.reduceSize;
1280
1280
  return offset;
1281
1281
  }
1282
- ${I("index")} {
1282
+ ${z("index")} {
1283
1283
  let outputIndex = index / ${n};
1284
1284
  let offset = getOffset(outputIndex);
1285
1285
  var bestValue = ${t};
@@ -1389,17 +1389,17 @@ var Va = {
1389
1389
  let r = [t];
1390
1390
  this.op = n === "min" ? "<" : ">";
1391
1391
  let [i, a] = wn(e, r);
1392
- this.outputShape = i.length === 0 ? [1] : i, this.dispatchLayout = R(this.outputShape), N(a) < 32 ? (this.type = "plain", this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize)) : (this.type = "shared", this.dispatch = z(this.dispatchLayout, this.outputShape, [
1392
+ this.outputShape = i.length === 0 ? [1] : i, this.dispatchLayout = P(this.outputShape), N(a) < 32 ? (this.type = "plain", this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize)) : (this.type = "shared", this.dispatch = F(this.dispatchLayout, this.outputShape, [
1393
1393
  1,
1394
1394
  1,
1395
1395
  1
1396
1396
  ])), this.inputShape = e, this.shaderKey = `argMinMax_${this.op}_${this.type}`;
1397
1397
  }
1398
1398
  getUserCode() {
1399
- let e = this.workgroupSize[0], t = () => this.inputShape.length === 1 ? "uniforms.xShape" : `uniforms.xShape.${hr(this.inputShape.length - 1)}`, n = () => {
1399
+ let e = this.workgroupSize[0], t = () => this.inputShape.length === 1 ? "uniforms.xShape" : `uniforms.xShape.${xr(this.inputShape.length - 1)}`, n = () => {
1400
1400
  let e = "";
1401
1401
  if (this.outputShape.length === 1) this.inputShape.length !== 1 && (e += "outputCoords,");
1402
- else for (let t = 0; t < this.outputShape.length; t++) e += `outputCoords.${hr(t)},`;
1402
+ else for (let t = 0; t < this.outputShape.length; t++) e += `outputCoords.${xr(t)},`;
1403
1403
  return e;
1404
1404
  };
1405
1405
  return this.type === "shared" ? `
@@ -1412,7 +1412,7 @@ var Va = {
1412
1412
  var<workgroup> xBestValues : array<f32, ${e}>;
1413
1413
  `}
1414
1414
 
1415
- ${I("index")} {
1415
+ ${z("index")} {
1416
1416
  let outputIndex = index / ${e};
1417
1417
  let reduceLength = ${t()};
1418
1418
 
@@ -1452,7 +1452,7 @@ var Va = {
1452
1452
  }
1453
1453
  }
1454
1454
  ` : `
1455
- ${I("index")} {
1455
+ ${z("index")} {
1456
1456
  if (index < uniforms.size) {
1457
1457
  let outputCoords = getCoordsFromIndex(index);
1458
1458
  var bestIndex = 0;
@@ -1536,11 +1536,11 @@ var Ka = {
1536
1536
  256,
1537
1537
  1,
1538
1538
  1
1539
- ], this.size = !0, this.outputShape = e.outShape, this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize), this.shaderKey = "poolWithFilterSizeEqualsOne";
1539
+ ], this.size = !0, this.outputShape = e.outShape, this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize), this.shaderKey = "poolWithFilterSizeEqualsOne";
1540
1540
  }
1541
1541
  getUserCode() {
1542
1542
  return `
1543
- ${I("index")} {
1543
+ ${z("index")} {
1544
1544
  if (index < uniforms.size) {
1545
1545
  let coords = getCoordsFromIndex(index);
1546
1546
  let batch = coords[0];
@@ -1563,7 +1563,7 @@ var Ka = {
1563
1563
  1,
1564
1564
  1
1565
1565
  ], this.size = !0, t === "avg" && n) throw Error("Cannot compute positions for average pool.");
1566
- this.outputShape = e.outShape, this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize), this.poolType = t, this.computePositions = n, this.flattenPositions = r, this.includeBatchIndex = i, this.shaderKey = `pool2D_${t}_${n}_${r}_${i}`;
1566
+ this.outputShape = e.outShape, this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize), this.poolType = t, this.computePositions = n, this.flattenPositions = r, this.includeBatchIndex = i, this.shaderKey = `pool2D_${t}_${n}_${r}_${i}`;
1567
1567
  }
1568
1568
  getUserCode() {
1569
1569
  let e;
@@ -1575,7 +1575,7 @@ var Ka = {
1575
1575
  }` : "resultValue = max(value, resultValue);";
1576
1576
  let t = "resultValue";
1577
1577
  return this.poolType === "avg" && (t = "resultValue / max(count, 1.0)"), `
1578
- ${I("index")} {
1578
+ ${z("index")} {
1579
1579
  if (index < uniforms.size) {
1580
1580
  let coords = getCoordsFromIndex(index);
1581
1581
  let batch = coords[0];
@@ -1617,7 +1617,7 @@ var Ka = {
1617
1617
  1,
1618
1618
  1
1619
1619
  ], this.size = !0, t === "avg" && n) throw Error("Cannot compute positions for average pool.");
1620
- this.outputShape = e.outShape, this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize), this.poolType = t, this.computePositions = n, this.flattenPositions = r, this.includeBatchIndex = i, this.shaderKey = `pool3D_${t}_${n}_${r}_${i}`;
1620
+ this.outputShape = e.outShape, this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize), this.poolType = t, this.computePositions = n, this.flattenPositions = r, this.includeBatchIndex = i, this.shaderKey = `pool3D_${t}_${n}_${r}_${i}`;
1621
1621
  }
1622
1622
  getUserCode() {
1623
1623
  let e;
@@ -1629,7 +1629,7 @@ var Ka = {
1629
1629
  }` : "resultValue = max(value, resultValue);";
1630
1630
  let t = "resultValue";
1631
1631
  return this.poolType === "avg" && (t = "resultValue / max(count, 1.0)"), `
1632
- ${I("index")} {
1632
+ ${z("index")} {
1633
1633
  if (index < uniforms.size) {
1634
1634
  let coords = getCoordsFromIndex(index);
1635
1635
  let batch = coords.x;
@@ -1812,11 +1812,11 @@ var lo = {
1812
1812
  64,
1813
1813
  1,
1814
1814
  1
1815
- ], this.size = !0, this.outputShape = e.inShape, this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize), this.shaderKey = "avgPool2DBackprop";
1815
+ ], this.size = !0, this.outputShape = e.inShape, this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize), this.shaderKey = "avgPool2DBackprop";
1816
1816
  }
1817
1817
  getUserCode() {
1818
1818
  return `
1819
- ${I("index")} {
1819
+ ${z("index")} {
1820
1820
  if (index < uniforms.size) {
1821
1821
  let coords = getCoordsFromIndex(index);
1822
1822
  let batch = coords[0];
@@ -1861,11 +1861,11 @@ var lo = {
1861
1861
  64,
1862
1862
  1,
1863
1863
  1
1864
- ], this.size = !0, this.outputShape = e.inShape, this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize), this.shaderKey = "avgPool3DBackprop";
1864
+ ], this.size = !0, this.outputShape = e.inShape, this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize), this.shaderKey = "avgPool3DBackprop";
1865
1865
  }
1866
1866
  getUserCode() {
1867
1867
  return `
1868
- ${I("index")} {
1868
+ ${z("index")} {
1869
1869
  if (index < uniforms.size) {
1870
1870
  let coords = getCoordsFromIndex(index);
1871
1871
  let batch = coords.x;
@@ -1971,7 +1971,7 @@ var mo = {
1971
1971
  //#region node_modules/@tensorflow/tfjs-backend-webgpu/dist/kernels/AvgPoolGrad.js
1972
1972
  function ho(e) {
1973
1973
  let { inputs: t, backend: n, attrs: r } = e, { dy: i, input: a } = t, o = a;
1974
- xr([i, a], "avgPoolGrad");
1974
+ _r([i, a], "avgPoolGrad");
1975
1975
  let { filterSize: s, strides: c, pad: l } = r, u = S(o.shape, s, c, 1, l), d = new uo(u), f = 1 / (u.filterHeight * u.filterWidth), p = [
1976
1976
  {
1977
1977
  type: "int32",
@@ -2031,16 +2031,16 @@ var vo = {
2031
2031
  64,
2032
2032
  1,
2033
2033
  1
2034
- ], this.size = !0, this.outputShape = t, this.rank = t.length, this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize, [
2034
+ ], this.size = !0, this.outputShape = t, this.rank = t.length, this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize, [
2035
2035
  this.workPerThread,
2036
2036
  1,
2037
2037
  1
2038
- ]), this.start = e, this.uniforms = `start : ${F(e.length)}, `, this.shaderKey = "slice";
2038
+ ]), this.start = e, this.uniforms = `start : ${R(e.length)}, `, this.shaderKey = "slice";
2039
2039
  }
2040
2040
  getUserCode() {
2041
- let e = F(this.rank), t = xo(this.rank), n;
2042
- return n = this.start.length === 1 ? this.outputShape.map((e, t) => "sourceLoc = uniforms.start + coords;") : this.outputShape.map((e, t) => `sourceLoc.${bo[t]} = uniforms.start.${hr(t)} + coords.${bo[t]};`), `
2043
- ${I("index")} {
2041
+ let e = R(this.rank), t = xo(this.rank), n;
2042
+ return n = this.start.length === 1 ? this.outputShape.map((e, t) => "sourceLoc = uniforms.start + coords;") : this.outputShape.map((e, t) => `sourceLoc.${bo[t]} = uniforms.start.${xr(t)} + coords.${bo[t]};`), `
2043
+ ${z("index")} {
2044
2044
  if (index < uniforms.size) {
2045
2045
  var sourceLoc : ${e};
2046
2046
  let coords = getCoordsFromIndex(index);
@@ -2112,7 +2112,7 @@ var Co = {
2112
2112
  }
2113
2113
  }, To = `
2114
2114
  fn bincount_write(index: i32, value: f32) {
2115
- ${P("&result[index]", "value", "float32")}
2115
+ ${L("&result[index]", "value", "float32")}
2116
2116
  }
2117
2117
  `, Eo = "\n fn bincount_write(index: i32, value: f32) {\n atomicStore(&result[index], bitcast<i32>(value));\n }\n", Do = class {
2118
2118
  constructor(e, t, n = !1) {
@@ -2120,12 +2120,12 @@ var Co = {
2120
2120
  64,
2121
2121
  1,
2122
2122
  1
2123
- ], this.atomic = !0, this.hasWeights = !0, this.binaryOutput = !1, this.outputShape = e, this.rank = e.length, this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize), this.binaryOutput = n, n && (this.atomic = !1), this.hasWeights = t, this.hasWeights && this.variableNames.push("w"), this.shaderKey = `bincount_${this.hasWeights}_${this.binaryOutput}_${this.rank}`;
2123
+ ], this.atomic = !0, this.hasWeights = !0, this.binaryOutput = !1, this.outputShape = e, this.rank = e.length, this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize), this.binaryOutput = n, n && (this.atomic = !1), this.hasWeights = t, this.hasWeights && this.variableNames.push("w"), this.shaderKey = `bincount_${this.hasWeights}_${this.binaryOutput}_${this.rank}`;
2124
2124
  }
2125
2125
  getUserCode() {
2126
2126
  return `
2127
2127
  ${this.binaryOutput ? Eo : To}
2128
- ${I("index")} {
2128
+ ${z("index")} {
2129
2129
  ${this.rank === 1 ? `if (index < uniforms.xShape) {
2130
2130
  let indexVal = i32(getX(index));
2131
2131
  if (indexVal < uniforms.binCountSize) {
@@ -2170,11 +2170,11 @@ var ko = {
2170
2170
  64,
2171
2171
  1,
2172
2172
  1
2173
- ], this.size = !0, this.outputShape = [e], this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize), this.shaderKey = "broadcastArgs";
2173
+ ], this.size = !0, this.outputShape = [e], this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize), this.shaderKey = "broadcastArgs";
2174
2174
  }
2175
2175
  getUserCode() {
2176
2176
  return `
2177
- ${I("index")} {
2177
+ ${z("index")} {
2178
2178
  if (index < uniforms.size) {
2179
2179
  var s0 = 1.0;
2180
2180
  var s1 = 1.0;
@@ -2333,7 +2333,7 @@ var zo = {
2333
2333
  64,
2334
2334
  1,
2335
2335
  1
2336
- ], this.outputComponent = 4, this.size = !0, this.outputShape = e, this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize, [
2336
+ ], this.outputComponent = 4, this.size = !0, this.outputShape = e, this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize, [
2337
2337
  this.workPerThread,
2338
2338
  1,
2339
2339
  1
@@ -2341,7 +2341,7 @@ var zo = {
2341
2341
  }
2342
2342
  getUserCode() {
2343
2343
  return `
2344
- ${I("index")} {
2344
+ ${z("index")} {
2345
2345
  if(index < uniforms.size) {
2346
2346
  let value = getAByOutputIndex(index);
2347
2347
  var clampedValue = clamp(
@@ -2358,11 +2358,11 @@ var zo = {
2358
2358
  64,
2359
2359
  1,
2360
2360
  1
2361
- ], this.size = !0, this.outputShape = e, this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize), this.shaderKey = "clip";
2361
+ ], this.size = !0, this.outputShape = e, this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize), this.shaderKey = "clip";
2362
2362
  }
2363
2363
  getUserCode() {
2364
2364
  return `
2365
- ${I("index")} {
2365
+ ${z("index")} {
2366
2366
  if(index < uniforms.size) {
2367
2367
  let value = getAByOutputIndex(index);
2368
2368
  if (isnan(value)) {
@@ -2397,11 +2397,11 @@ var Wo = {
2397
2397
  64,
2398
2398
  1,
2399
2399
  1
2400
- ], this.size = !0, this.outputShape = e, this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize), this.shaderKey = "complexAbs";
2400
+ ], this.size = !0, this.outputShape = e, this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize), this.shaderKey = "complexAbs";
2401
2401
  }
2402
2402
  getUserCode() {
2403
2403
  return `
2404
- ${I("index")} {
2404
+ ${z("index")} {
2405
2405
  if (index < uniforms.size) {
2406
2406
  let re = abs(getRealByOutputIndex(index));
2407
2407
  let im = abs(getImagByOutputIndex(index));
@@ -2438,7 +2438,7 @@ var Jo = {
2438
2438
  64,
2439
2439
  1,
2440
2440
  1
2441
- ], this.size = !0, this.outputShape = dr(e, 1), this.variableNames = e.map((e, t) => `T${t}`), this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize, [
2441
+ ], this.size = !0, this.outputShape = dr(e, 1), this.variableNames = e.map((e, t) => `T${t}`), this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize, [
2442
2442
  this.workPerThread,
2443
2443
  1,
2444
2444
  1
@@ -2455,7 +2455,7 @@ var Jo = {
2455
2455
  e.push(`else { setOutputAtCoords(coords.x, coords.y, getT${t}(yR, yC - uniforms.offset${n})); }`);
2456
2456
  } else e.push("setOutputAtCoords(coords.x, coords.y, getT0(yR, yC));");
2457
2457
  return `
2458
- ${I("index")} {
2458
+ ${z("index")} {
2459
2459
  for(var i = 0; i < ${this.workPerThread}; i = i + 1) {
2460
2460
  let flatIndex = index * ${this.workPerThread} + i;
2461
2461
  if(flatIndex < uniforms.size) {
@@ -2606,7 +2606,7 @@ function ns(e, t, n, r, i = !1, a = null, o = !1, s = 4, c = 4, l = 4) {
2606
2606
  let xRow = outRow * uniforms.strides[0] + uniforms.dilations[0] * WRow - uniforms.pads[0];
2607
2607
  let xCol = outCol * uniforms.strides[1] + uniforms.dilations[1] * WCol - uniforms.pads[1];
2608
2608
  let xCh = ${_} % inChannels;
2609
- var resData = ${L(s)}(0.0);
2609
+ var resData = ${B(s)}(0.0);
2610
2610
  // The bounds checking is always needed since we use it to pad zero for
2611
2611
  // the 'same' padding type.
2612
2612
  if (xRow >= 0 && xRow < ${m} && xCol >= 0 && xCol < ${h}) {
@@ -2619,12 +2619,12 @@ function ns(e, t, n, r, i = !1, a = null, o = !1, s = 4, c = 4, l = 4) {
2619
2619
  if (row < uniforms.dimAOuter && col < uniforms.dimInner) {
2620
2620
  ${v}
2621
2621
  }
2622
- return ${L(s)}(0.0);` : r && n ? `
2622
+ return ${B(s)}(0.0);` : r && n ? `
2623
2623
  ${v}` : `
2624
2624
  if (row < uniforms.dimInner && col < uniforms.dimBOuter) {
2625
2625
  ${v}
2626
2626
  }
2627
- return ${L(s)}(0.0);`, b = `${d(c)}`, x = L(l), S = L(e ? s : c), C = L(e ? c : s);
2627
+ return ${B(s)}(0.0);`, b = `${d(c)}`, x = B(l), S = B(e ? s : c), C = B(e ? c : s);
2628
2628
  return `
2629
2629
  ${G(a, o, l === 4, 4)}
2630
2630
  fn mm_readA(batch: i32, row : i32, col : i32) -> ${S} {
@@ -2656,7 +2656,7 @@ var rs = class {
2656
2656
  x: [2, 3],
2657
2657
  y: [1],
2658
2658
  z: [0]
2659
- }, this.workgroupSize = Sr(this.dispatchLayout, this.outputShape, this.isVec4), this.elementsPerThread = vr(this.dispatchLayout, this.outputShape, this.isVec4), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize, this.elementsPerThread), this.isVec4 ? (this.outputComponent = 4, this.isChannelsLast && e.inChannels % 4 != 0 ? (this.innerElementSize = 3, this.variableComponents = [1, 4]) : (this.innerElementSize = 4, this.variableComponents = [4, 4]), i && (this.variableNames.push("bias"), this.variableComponents.push(4)), o && (this.variableNames.push("preluActivationWeights"), this.variableComponents.push(4))) : (this.innerElementSize = this.elementsPerThread[0], i && this.variableNames.push("bias"), o && this.variableNames.push("preluActivationWeights")), this.sequentialAccessByThreads = s, this.addBias = i, this.activation = a, this.hasPreluActivationWeights = o, this.tileAOuter = this.workgroupSize[1] * this.elementsPerThread[1], this.tileBOuter = this.workgroupSize[0] * this.elementsPerThread[0], this.tileInner = Math.max(this.workgroupSize[0] * this.innerElementSize, this.workgroupSize[1]), this.fitAOuter = t % this.tileAOuter === 0, this.fitBOuter = n % this.tileBOuter === 0, this.fitInner = r % this.tileInner === 0, this.shaderKey = `conv2DMM_${this.elementsPerThread}_${this.activation}}_${this.fitAOuter}_${this.fitBOuter}_${this.fitInner}_${this.isVec4}_${this.innerElementSize}_${this.isChannelsLast}_${this.sequentialAccessByThreads}`;
2659
+ }, this.workgroupSize = vr(this.dispatchLayout, this.outputShape, this.isVec4), this.elementsPerThread = mr(this.dispatchLayout, this.outputShape, this.isVec4), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize, this.elementsPerThread), this.isVec4 ? (this.outputComponent = 4, this.isChannelsLast && e.inChannels % 4 != 0 ? (this.innerElementSize = 3, this.variableComponents = [1, 4]) : (this.innerElementSize = 4, this.variableComponents = [4, 4]), i && (this.variableNames.push("bias"), this.variableComponents.push(4)), o && (this.variableNames.push("preluActivationWeights"), this.variableComponents.push(4))) : (this.innerElementSize = this.elementsPerThread[0], i && this.variableNames.push("bias"), o && this.variableNames.push("preluActivationWeights")), this.sequentialAccessByThreads = s, this.addBias = i, this.activation = a, this.hasPreluActivationWeights = o, this.tileAOuter = this.workgroupSize[1] * this.elementsPerThread[1], this.tileBOuter = this.workgroupSize[0] * this.elementsPerThread[0], this.tileInner = Math.max(this.workgroupSize[0] * this.innerElementSize, this.workgroupSize[1]), this.fitAOuter = t % this.tileAOuter === 0, this.fitBOuter = n % this.tileBOuter === 0, this.fitInner = r % this.tileInner === 0, this.shaderKey = `conv2DMM_${this.elementsPerThread}_${this.activation}}_${this.fitAOuter}_${this.fitBOuter}_${this.fitInner}_${this.isVec4}_${this.innerElementSize}_${this.isChannelsLast}_${this.sequentialAccessByThreads}`;
2660
2660
  }
2661
2661
  getUserCode() {
2662
2662
  let e = this.isVec4 ? xi(this.elementsPerThread, this.workgroupSize, !this.isChannelsLast, this.tileInner) : wi(this.elementsPerThread, this.workgroupSize, !this.isChannelsLast, this.tileInner, !1, null, this.sequentialAccessByThreads), t = this.isVec4 ? [
@@ -2687,7 +2687,7 @@ var rs = class {
2687
2687
  x: [3],
2688
2688
  y: [2],
2689
2689
  z: [0, 1]
2690
- }, this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize), this.addBias = t, this.activation = n, this.hasPreluActivationWeights = r, t && this.variableNames.push("bias"), r && this.variableNames.push("preluActivationWeights"), this.shaderKey = `conv2dnaive_${this.activation}_${this.isChannelsLast}`;
2690
+ }, this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize), this.addBias = t, this.activation = n, this.hasPreluActivationWeights = r, t && this.variableNames.push("bias"), r && this.variableNames.push("preluActivationWeights"), this.shaderKey = `conv2dnaive_${this.activation}_${this.isChannelsLast}`;
2691
2691
  }
2692
2692
  getUserCode() {
2693
2693
  return `
@@ -2716,7 +2716,7 @@ var rs = class {
2716
2716
  setOutputAtCoords(coords.x, coords.y, coords.z, coords.w, value);
2717
2717
  }
2718
2718
  }
2719
- ${I("index")} {
2719
+ ${z("index")} {
2720
2720
  let coords = getOutputCoords();
2721
2721
  let batch = coords[0];
2722
2722
  let outChannel = ${this.isChannelsLast ? "coords[3];" : "coords[1];"}
@@ -2744,12 +2744,12 @@ var rs = class {
2744
2744
  64,
2745
2745
  1,
2746
2746
  1
2747
- ], this.size = !0, this.outputShape = e, this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize), this.isChannelsLast = t, this.shaderKey = `im2col_${this.isChannelsLast}`;
2747
+ ], this.size = !0, this.outputShape = e, this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize), this.isChannelsLast = t, this.shaderKey = `im2col_${this.isChannelsLast}`;
2748
2748
  }
2749
2749
  getUserCode() {
2750
2750
  let e = this.isChannelsLast ? 1 : 2, t = this.isChannelsLast ? 2 : 3, n = this.isChannelsLast ? "coords[1]" : "coords[2]", r = this.isChannelsLast ? "coords[2]" : "coords[1]", i = this.isChannelsLast ? "getX(batch, xRow, xCol, ch)" : "getX(batch, ch, xRow, xCol)";
2751
2751
  return `
2752
- ${I("index")} {
2752
+ ${z("index")} {
2753
2753
  let coords = getCoordsFromIndex(index);
2754
2754
  if(index < uniforms.size) {
2755
2755
  let batch = coords[0];
@@ -3054,7 +3054,7 @@ var ds = {
3054
3054
  x: [3],
3055
3055
  y: [2],
3056
3056
  z: [0, 1]
3057
- }, this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize, [
3057
+ }, this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize, [
3058
3058
  4,
3059
3059
  this.workPerThread,
3060
3060
  1
@@ -3062,11 +3062,11 @@ var ds = {
3062
3062
  64,
3063
3063
  1,
3064
3064
  1
3065
- ], this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize)), this.shaderKey = `conv2DDerInput_${this.isChannelsLast}_${this.isVec4}_${this.workPerThread}`;
3065
+ ], this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize)), this.shaderKey = `conv2DDerInput_${this.isChannelsLast}_${this.isVec4}_${this.workPerThread}`;
3066
3066
  }
3067
3067
  getUserCode() {
3068
3068
  let e = this.isChannelsLast ? 1 : 2, t = this.isChannelsLast ? 2 : 3, n = this.isChannelsLast ? 3 : 1, r = `
3069
- ${I()} {
3069
+ ${z()} {
3070
3070
  let batch = i32(globalId.z) / uniforms.outShape[1];
3071
3071
  let r = i32(globalId.z) % uniforms.outShape[1];
3072
3072
  let c = i32(globalId.y) * ${this.workPerThread};
@@ -3168,7 +3168,7 @@ var ds = {
3168
3168
  return this.isVec4 ? `
3169
3169
  ${r}
3170
3170
  ` : `
3171
- ${I("index")} {
3171
+ ${z("index")} {
3172
3172
  if(index < uniforms.size) {
3173
3173
  let coords = getCoordsFromIndex(index);
3174
3174
  let batch = coords[0];
@@ -3217,11 +3217,11 @@ var ds = {
3217
3217
  64,
3218
3218
  1,
3219
3219
  1
3220
- ], this.size = !0, this.outputShape = e.filterShape, this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize), this.isChannelsLast = e.dataFormat === "channelsLast", this.shaderKey = `conv2DDerFilter_${this.isChannelsLast}`;
3220
+ ], this.size = !0, this.outputShape = e.filterShape, this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize), this.isChannelsLast = e.dataFormat === "channelsLast", this.shaderKey = `conv2DDerFilter_${this.isChannelsLast}`;
3221
3221
  }
3222
3222
  getUserCode() {
3223
3223
  return `
3224
- ${I("index")} {
3224
+ ${z("index")} {
3225
3225
  if(index < uniforms.size) {
3226
3226
  let coords = getCoordsFromIndex(index);
3227
3227
  let wR = coords[0];
@@ -3269,11 +3269,11 @@ var ds = {
3269
3269
  64,
3270
3270
  1,
3271
3271
  1
3272
- ], this.size = !0, this.outputShape = e.filterShape, this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize), this.shaderKey = "conv3DDerFilter";
3272
+ ], this.size = !0, this.outputShape = e.filterShape, this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize), this.shaderKey = "conv3DDerFilter";
3273
3273
  }
3274
3274
  getUserCode() {
3275
3275
  return `
3276
- ${I("index")} {
3276
+ ${z("index")} {
3277
3277
  if(index < uniforms.size) {
3278
3278
  let coords = getCoordsFromIndex(index);
3279
3279
  let wF = coords.x;
@@ -3320,11 +3320,11 @@ var ds = {
3320
3320
  64,
3321
3321
  1,
3322
3322
  1
3323
- ], this.size = !0, this.outputShape = e.inShape, this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize), this.shaderKey = "conv3DDerInput";
3323
+ ], this.size = !0, this.outputShape = e.inShape, this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize), this.shaderKey = "conv3DDerInput";
3324
3324
  }
3325
3325
  getUserCode() {
3326
3326
  return `
3327
- ${I("index")} {
3327
+ ${z("index")} {
3328
3328
  if(index < uniforms.size) {
3329
3329
  let coords = getCoordsFromIndex(index);
3330
3330
  let batch = coords.x;
@@ -3438,10 +3438,10 @@ function vs(e = 4) {
3438
3438
  let xR = f32(outRow - uniforms.pads[0] + WRow) / f32(uniforms.strides[0]);
3439
3439
  let xC = f32(outCol - uniforms.pads[1] + WCol) / f32(uniforms.strides[1]);
3440
3440
  if (xR < 0.0 || xR >= f32(uniforms.outBackprop[1]) || fract(xR) > 0.0) {
3441
- return ${L(e)}(0.0);
3441
+ return ${B(e)}(0.0);
3442
3442
  }
3443
3443
  if (xC < 0.0 || xC >= f32(uniforms.outBackprop[2]) || fract(xC) > 0.0) {
3444
- return ${L(e)}(0.0);
3444
+ return ${B(e)}(0.0);
3445
3445
  }
3446
3446
  let coord = vec4<i32>(
3447
3447
  batch,
@@ -3450,13 +3450,13 @@ function vs(e = 4) {
3450
3450
  col % uniforms.outBackprop[3]);
3451
3451
  return x[getIndexFromCoords4D(coord, uniforms.xShape)/${e}];`}
3452
3452
  }
3453
- return ${L(e)}(0.0);`;
3453
+ return ${B(e)}(0.0);`;
3454
3454
  return `
3455
- fn mm_readA(batch: i32, row : i32, col : i32) -> ${L(e)} {
3455
+ fn mm_readA(batch: i32, row : i32, col : i32) -> ${B(e)} {
3456
3456
  ${n}
3457
3457
  }
3458
3458
 
3459
- fn mm_readB(batch: i32, row : i32, col : i32) -> ${L(e)} {
3459
+ fn mm_readB(batch: i32, row : i32, col : i32) -> ${B(e)} {
3460
3460
  let coordX = uniforms.filterDims.x - 1 -
3461
3461
  row / (uniforms.filterDims[1] * uniforms.outBackprop[3]);
3462
3462
  let coordY = uniforms.filterDims.y - 1 -
@@ -3467,10 +3467,10 @@ function vs(e = 4) {
3467
3467
  let coord = vec4<i32>(coordX, coordY, col, rowInner);
3468
3468
  ${t(e)}
3469
3469
  }
3470
- return ${L(e)}(0.0);
3470
+ return ${B(e)}(0.0);
3471
3471
  }
3472
3472
 
3473
- fn mm_write(batch: i32, row : i32, col : i32, valueInput : ${L(e)}) {
3473
+ fn mm_write(batch: i32, row : i32, col : i32, valueInput : ${B(e)}) {
3474
3474
  if (row < uniforms.dimAOuter && col < uniforms.dimBOuter) {
3475
3475
  var value = valueInput;
3476
3476
  let outCoord = vec4<i32>(
@@ -3488,7 +3488,7 @@ var ys = class {
3488
3488
  x: [3],
3489
3489
  y: [1, 2],
3490
3490
  z: [0]
3491
- }, this.workgroupSize = Sr(this.dispatchLayout, this.outputShape, this.isVec4), this.elementsPerThread = vr(this.dispatchLayout, this.outputShape, this.isVec4), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize, this.elementsPerThread), this.isVec4 && (this.outputComponent = 4, this.variableComponents = [4, 1]), this.shaderKey = `conv2DDerInputMM_${this.isVec4}_${this.elementsPerThread}`;
3491
+ }, this.workgroupSize = vr(this.dispatchLayout, this.outputShape, this.isVec4), this.elementsPerThread = mr(this.dispatchLayout, this.outputShape, this.isVec4), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize, this.elementsPerThread), this.isVec4 && (this.outputComponent = 4, this.variableComponents = [4, 1]), this.shaderKey = `conv2DDerInputMM_${this.isVec4}_${this.elementsPerThread}`;
3492
3492
  }
3493
3493
  getUserCode() {
3494
3494
  let e = this.isVec4 ? xi(this.elementsPerThread, this.workgroupSize) : wi(this.elementsPerThread, this.workgroupSize);
@@ -3551,11 +3551,11 @@ var xs = {
3551
3551
  64,
3552
3552
  1,
3553
3553
  1
3554
- ], this.size = !0, this.outputShape = e.outShape, this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize), this.shaderKey = "conv3dnaive";
3554
+ ], this.size = !0, this.outputShape = e.outShape, this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize), this.shaderKey = "conv3dnaive";
3555
3555
  }
3556
3556
  getUserCode() {
3557
3557
  return `
3558
- ${I("index")} {
3558
+ ${z("index")} {
3559
3559
  if (index < uniforms.size) {
3560
3560
  let coords = getOutputCoords();
3561
3561
  let batch = coords.x;
@@ -3815,7 +3815,7 @@ var Os = {
3815
3815
  n[0],
3816
3816
  n[1],
3817
3817
  e
3818
- ], this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize), this.methodId = +(r === "bilinear"), this.cropHeightBiggerThan1 = this.outputShape[1] > 1, this.cropWidthBiggerThan1 = this.outputShape[2] > 1, this.shaderKey = `cropAndResize_${this.methodId}_${this.cropHeightBiggerThan1}_${this.cropWidthBiggerThan1}`;
3818
+ ], this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize), this.methodId = +(r === "bilinear"), this.cropHeightBiggerThan1 = this.outputShape[1] > 1, this.cropWidthBiggerThan1 = this.outputShape[2] > 1, this.shaderKey = `cropAndResize_${this.methodId}_${this.cropHeightBiggerThan1}_${this.cropWidthBiggerThan1}`;
3819
3819
  }
3820
3820
  getUserCode() {
3821
3821
  let [e, t] = ["f32(uniforms.imageShape[1] - 1)", "f32(uniforms.imageShape[2] - 1)"], [n, r, i] = this.cropHeightBiggerThan1 ? [
@@ -3836,7 +3836,7 @@ var Os = {
3836
3836
  `0.5 * (x1+x2) * ${t}`
3837
3837
  ];
3838
3838
  return `
3839
- ${I("index")} {
3839
+ ${z("index")} {
3840
3840
  if (index < uniforms.size) {
3841
3841
  let coords = getCoordsFromIndex(index);
3842
3842
  let height_ratio = f32(${n});
@@ -3917,12 +3917,12 @@ var Ps = class {
3917
3917
  128,
3918
3918
  1,
3919
3919
  1
3920
- ], this.outputShape = t, this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize), this.exclusive = n, this.reverse = r, this.op = e, this.shaderKey = `cum_${this.op}_${this.exclusive}_${this.reverse}`;
3920
+ ], this.outputShape = t, this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize), this.exclusive = n, this.reverse = r, this.op = e, this.shaderKey = `cum_${this.op}_${this.exclusive}_${this.reverse}`;
3921
3921
  }
3922
3922
  getUserCode() {
3923
3923
  let e = this.outputShape.length, t = this.op === Ns.Prod ? "1.0" : "0.0", n = this.exclusive ? t : `getX(${Fs(e, "coords", this.op)})`, r = this.outputShape[this.outputShape.length - 1], i = "", a = "";
3924
3924
  return this.exclusive ? (i = this.reverse ? `end != ${r - 1}` : "end != 0", a = this.reverse ? "end + 1" : "end - 1") : (i = this.reverse ? `end + pow2 < ${r}` : "end >= pow2", a = this.reverse ? "end + pow2" : "end - pow2"), `
3925
- ${I("index")} {
3925
+ ${z("index")} {
3926
3926
  if (index < uniforms.size) {
3927
3927
  var coords = getCoordsFromIndex(index);
3928
3928
 
@@ -4041,11 +4041,11 @@ var Us = {
4041
4041
  64,
4042
4042
  1,
4043
4043
  1
4044
- ], this.size = !0, this.uniforms = "blockSize : i32,", this.outputShape = e, this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize), this.shaderKey = `depthToSpace_${t}`, this.dataFormat = t;
4044
+ ], this.size = !0, this.uniforms = "blockSize : i32,", this.outputShape = e, this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize), this.shaderKey = `depthToSpace_${t}`, this.dataFormat = t;
4045
4045
  }
4046
4046
  getUserCode() {
4047
4047
  return `
4048
- ${I("index")} {
4048
+ ${z("index")} {
4049
4049
  if (index < uniforms.size) {
4050
4050
  let coords = getCoordsFromIndex(index);
4051
4051
  let b = coords[0];
@@ -4115,7 +4115,7 @@ var Ks = {
4115
4115
  x: [3],
4116
4116
  y: [2],
4117
4117
  z: [0, 1]
4118
- }, this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize), r && this.variableNames.push("bias"), a && this.variableNames.push("preluActivationWeights"), this.addBias = r, this.activation = i, this.hasPreluActivation = a, this.filterHeight = t, this.filterWidth = n, this.shaderKey = `depthwiseNCHW_${this.activation}_${this.filterHeight}_${this.filterWidth}`;
4118
+ }, this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize), r && this.variableNames.push("bias"), a && this.variableNames.push("preluActivationWeights"), this.addBias = r, this.activation = i, this.hasPreluActivation = a, this.filterHeight = t, this.filterWidth = n, this.shaderKey = `depthwiseNCHW_${this.activation}_${this.filterHeight}_${this.filterWidth}`;
4119
4119
  }
4120
4120
  getUserCode() {
4121
4121
  let e = this.filterWidth * this.filterHeight, t = this.workgroupSize[0] * this.workgroupSize[1] * this.workgroupSize[2], n = this.workgroupSize[1] + this.filterHeight - 1, r = this.workgroupSize[0] + this.filterWidth - 1;
@@ -4133,7 +4133,7 @@ var Ks = {
4133
4133
  return value;
4134
4134
  }
4135
4135
 
4136
- ${I()} {
4136
+ ${z()} {
4137
4137
  let coords = getOutputCoords();
4138
4138
  let batch = coords[0];
4139
4139
  let xRCCorner = vec2<i32>(coords.zw) - uniforms.pads;
@@ -4196,7 +4196,7 @@ var Ks = {
4196
4196
  this.virtualWidth,
4197
4197
  this.outputShape[3]
4198
4198
  ];
4199
- this.dispatchLayout = R(i), this.dispatch = z(this.dispatchLayout, i, this.workgroupSize, [
4199
+ this.dispatchLayout = P(i), this.dispatch = F(this.dispatchLayout, i, this.workgroupSize, [
4200
4200
  this.outputComponent * this.workPerThread,
4201
4201
  1,
4202
4202
  1
@@ -4214,7 +4214,7 @@ var Ks = {
4214
4214
  return value;
4215
4215
  }
4216
4216
 
4217
- ${I("index")} {
4217
+ ${z("index")} {
4218
4218
  let width0 = uniforms.outShape[3] / ${this.outputComponent};
4219
4219
  let d1 = (index % width0) * ${this.outputComponent};
4220
4220
  var index1 = index / width0;
@@ -4267,14 +4267,14 @@ var Ks = {
4267
4267
  256,
4268
4268
  1,
4269
4269
  1
4270
- ], this.size = !0, this.outputShape = e.outShape, this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize), this.isChannelsLast = e.dataFormat === "channelsLast", t && this.variableNames.push("bias"), r && this.variableNames.push("preluActivationWeights"), this.convInfo = e, this.addBias = t, this.activation = n, this.hasPreluActivation = r, this.shaderKey = `depthwise_${this.activation}_${this.isChannelsLast}`;
4270
+ ], this.size = !0, this.outputShape = e.outShape, this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize), this.isChannelsLast = e.dataFormat === "channelsLast", t && this.variableNames.push("bias"), r && this.variableNames.push("preluActivationWeights"), this.convInfo = e, this.addBias = t, this.activation = n, this.hasPreluActivation = r, this.shaderKey = `depthwise_${this.activation}_${this.isChannelsLast}`;
4271
4271
  }
4272
4272
  getUserCode() {
4273
4273
  let e = this.isChannelsLast ? "getX(batch, xR, xC, d1);" : "getX(batch, d1, xR, xC);";
4274
4274
  return `
4275
4275
  ${G(this.activation, this.hasPreluActivation, !1, 4)}
4276
4276
 
4277
- ${I("index")} {
4277
+ ${z("index")} {
4278
4278
  if (index < uniforms.size) {
4279
4279
  let coords = getOutputCoords();
4280
4280
  let batch = coords[0];
@@ -4379,11 +4379,11 @@ var Zs = {
4379
4379
  64,
4380
4380
  1,
4381
4381
  1
4382
- ], this.size = !0, this.outputShape = e.filterShape, this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize), this.shaderKey = "depthwise_conv2d_backprop_filter";
4382
+ ], this.size = !0, this.outputShape = e.filterShape, this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize), this.shaderKey = "depthwise_conv2d_backprop_filter";
4383
4383
  }
4384
4384
  getUserCode() {
4385
4385
  return `
4386
- ${I("index")} {
4386
+ ${z("index")} {
4387
4387
  if (index < uniforms.size) {
4388
4388
  let coords = getCoordsFromIndex(index);
4389
4389
  let wR = coords[0];
@@ -4425,11 +4425,11 @@ var Zs = {
4425
4425
  64,
4426
4426
  1,
4427
4427
  1
4428
- ], this.size = !0, this.outputShape = e.inShape, this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize), this.shaderKey = "depthwise_conv2d_backprop_input";
4428
+ ], this.size = !0, this.outputShape = e.inShape, this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize), this.shaderKey = "depthwise_conv2d_backprop_input";
4429
4429
  }
4430
4430
  getUserCode() {
4431
4431
  return `
4432
- ${I("index")} {
4432
+ ${z("index")} {
4433
4433
  if (index < uniforms.size) {
4434
4434
  let coords = getCoordsFromIndex(index);
4435
4435
  let batch = coords[0];
@@ -4562,11 +4562,11 @@ var rc = {
4562
4562
  64,
4563
4563
  1,
4564
4564
  1
4565
- ], this.size = !0, this.outputShape = [e, e], this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize), this.shaderKey = "diag";
4565
+ ], this.size = !0, this.outputShape = [e, e], this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize), this.shaderKey = "diag";
4566
4566
  }
4567
4567
  getUserCode() {
4568
4568
  return `
4569
- ${I("index")} {
4569
+ ${z("index")} {
4570
4570
  if (index < uniforms.size) {
4571
4571
  let coords = getOutputCoords();
4572
4572
  let value = select(0.0, getX(coords[0]), coords[0] == coords[1]);
@@ -4600,11 +4600,11 @@ var oc = {
4600
4600
  64,
4601
4601
  1,
4602
4602
  1
4603
- ], this.size = !0, this.outputShape = e.outShape, this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize), this.shaderKey = "dilation2d";
4603
+ ], this.size = !0, this.outputShape = e.outShape, this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize), this.shaderKey = "dilation2d";
4604
4604
  }
4605
4605
  getUserCode() {
4606
4606
  return `
4607
- ${I("index")} {
4607
+ ${z("index")} {
4608
4608
  if (index < uniforms.size) {
4609
4609
  let neg_infinity = -3.4e38;
4610
4610
  let coords = getOutputCoords();
@@ -4675,13 +4675,13 @@ var lc = {
4675
4675
  64,
4676
4676
  1,
4677
4677
  1
4678
- ], this.atomic = !0, this.outputShape = e.inShape, this.dispatchLayout = R(e.outShape), this.dispatch = z(this.dispatchLayout, e.outShape, this.workgroupSize), t !== "float32" && t !== "int32") throw Error(`Dilation2DBackpropInput only supports float32 and int32
4678
+ ], this.atomic = !0, this.outputShape = e.inShape, this.dispatchLayout = P(e.outShape), this.dispatch = F(this.dispatchLayout, e.outShape, this.workgroupSize), t !== "float32" && t !== "int32") throw Error(`Dilation2DBackpropInput only supports float32 and int32
4679
4679
  types, does not support ${t} type.`);
4680
4680
  this.type = t, this.shaderKey = "dilation2DBackpropInput";
4681
4681
  }
4682
4682
  getUserCode() {
4683
4683
  return `
4684
- ${I("index")} {
4684
+ ${z("index")} {
4685
4685
  if (index < uniforms.dySize) {
4686
4686
  let coords = getDyCoordsFromIndex(index);
4687
4687
  let b = coords[0];
@@ -4720,7 +4720,7 @@ var lc = {
4720
4720
  let flatIndexIn = d + uniforms.xShape[3] *
4721
4721
  (xCMax + uniforms.xShape[2] * (xRMax + uniforms.xShape[1] * b));
4722
4722
  let value = getDy(b, r, c, d);
4723
- ${P("&result[flatIndexIn]", "value", this.type)}
4723
+ ${L("&result[flatIndexIn]", "value", this.type)}
4724
4724
  }
4725
4725
  }
4726
4726
  `;
@@ -4735,13 +4735,13 @@ var lc = {
4735
4735
  64,
4736
4736
  1,
4737
4737
  1
4738
- ], this.atomic = !0, this.outputShape = e.filterShape, this.dispatchLayout = R(e.outShape), this.dispatch = z(this.dispatchLayout, e.outShape, this.workgroupSize), n !== "float32" && n !== "int32") throw Error(`Dilation2DBackpropFilter only supports float32 and int32
4738
+ ], this.atomic = !0, this.outputShape = e.filterShape, this.dispatchLayout = P(e.outShape), this.dispatch = F(this.dispatchLayout, e.outShape, this.workgroupSize), n !== "float32" && n !== "int32") throw Error(`Dilation2DBackpropFilter only supports float32 and int32
4739
4739
  types, does not support ${n} type.`);
4740
4740
  this.type = n, this.shaderKey = "dilation2DBackpropFilter";
4741
4741
  }
4742
4742
  getUserCode() {
4743
4743
  return `
4744
- ${I("index")} {
4744
+ ${z("index")} {
4745
4745
  if (index < uniforms.dySize) {
4746
4746
  let coords = getDyCoordsFromIndex(index);
4747
4747
  let b = coords[0];
@@ -4779,7 +4779,7 @@ var lc = {
4779
4779
 
4780
4780
  let flatIndexIn = d + uniforms.wShape[2] * (wCMax + wRMax * uniforms.wShape[1]);
4781
4781
  let value = getDy(b, r, c, d);
4782
- ${P("&result[flatIndexIn]", "value", this.type)}
4782
+ ${L("&result[flatIndexIn]", "value", this.type)}
4783
4783
  }
4784
4784
  }
4785
4785
  `;
@@ -4876,7 +4876,7 @@ var hc = {
4876
4876
  64,
4877
4877
  1,
4878
4878
  1
4879
- ], this.pixelsOpType = _r.DRAW, this.size = !0, this.outputShape = e, this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize), this.type = t, this.textureFormat = n, this.shaderKey = `draw_${t}_${n}`;
4879
+ ], this.pixelsOpType = Cr.DRAW, this.size = !0, this.outputShape = e, this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize), this.type = t, this.textureFormat = n, this.shaderKey = `draw_${t}_${n}`;
4880
4880
  }
4881
4881
  getUserCode() {
4882
4882
  let e, t = this.type === "float32" ? "value" : "value / 255.0";
@@ -4889,7 +4889,7 @@ var hc = {
4889
4889
  rgba[d] = ${t};
4890
4890
  }`, `
4891
4891
  @group(0) @binding(0) var outImage : texture_storage_2d<${this.textureFormat}, write>;
4892
- ${I("index")} {
4892
+ ${z("index")} {
4893
4893
  if (index < uniforms.size) {
4894
4894
  var rgba = vec4<f32>(0.0, 0.0, 0.0, uniforms.alpha);
4895
4895
  for (var d = 0; d < uniforms.numChannels; d = d + 1) {
@@ -5063,7 +5063,7 @@ var jc = {
5063
5063
  64,
5064
5064
  1,
5065
5065
  1
5066
- ], this.size = !0, this.outputShape = t, this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize), this.component = e, this.shaderKey = `fft_${e}`;
5066
+ ], this.size = !0, this.outputShape = t, this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize), this.component = e, this.shaderKey = `fft_${e}`;
5067
5067
  }
5068
5068
  getUserCode() {
5069
5069
  return `
@@ -5093,7 +5093,7 @@ var jc = {
5093
5093
  return result;
5094
5094
  }
5095
5095
 
5096
- ${I("index")} {
5096
+ ${z("index")} {
5097
5097
  if (index < uniforms.size) {
5098
5098
  let coords = getOutputCoords();
5099
5099
  setOutputAtIndex(index, mulMatDFT(coords[0], coords[1]));
@@ -5160,11 +5160,11 @@ var Ic = {
5160
5160
  64,
5161
5161
  1,
5162
5162
  1
5163
- ], this.size = !0, this.outputShape = e, this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize), this.shaderKey = "flipLeftRight";
5163
+ ], this.size = !0, this.outputShape = e, this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize), this.shaderKey = "flipLeftRight";
5164
5164
  }
5165
5165
  getUserCode() {
5166
5166
  return `
5167
- ${I("index")} {
5167
+ ${z("index")} {
5168
5168
  if (index < uniforms.size) {
5169
5169
  let coords = getCoordsFromIndex(index);
5170
5170
  let coordX = uniforms.xShape[2] - coords[2] - 1;
@@ -5198,11 +5198,11 @@ var Ic = {
5198
5198
  })
5199
5199
  }, Vc = class {
5200
5200
  constructor(e, t, n = !1) {
5201
- this.pixelsOpType = _r.FROM_PIXELS, this.outputShape = [0], this.variableNames = [], this.workgroupSize = [
5201
+ this.pixelsOpType = Cr.FROM_PIXELS, this.outputShape = [0], this.variableNames = [], this.workgroupSize = [
5202
5202
  256,
5203
5203
  1,
5204
5204
  1
5205
- ], this.outputShape = e, this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize, [
5205
+ ], this.outputShape = e, this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize, [
5206
5206
  t,
5207
5207
  1,
5208
5208
  1
@@ -5212,7 +5212,7 @@ var Ic = {
5212
5212
  let e = this.importVideo ? "textureLoad(src, vec2<i32>(coords.yx));" : "textureLoad(src, vec2<i32>(coords.yx), 0)";
5213
5213
  return `
5214
5214
  @binding(1) @group(0) var src: ${this.importVideo ? "texture_external" : "texture_2d<f32>"};
5215
- ${I("index")} {
5215
+ ${z("index")} {
5216
5216
  let flatIndex = index * uniforms.numChannels;
5217
5217
  if (flatIndex < uniforms.size) {
5218
5218
  let coords = getCoordsFromIndex(flatIndex);
@@ -5287,14 +5287,14 @@ var Kc = class {
5287
5287
  "x",
5288
5288
  "mean",
5289
5289
  "variance"
5290
- ], k(e, t), k(e, n), this.outputShape = e, this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize), r != null && (k(e, r), this.variableNames.push("offset")), i != null && (k(e, i), this.variableNames.push("scale")), this.offsetShape = r, this.scaleShape = i, this.shaderKey = "batchNorm";
5290
+ ], k(e, t), k(e, n), this.outputShape = e, this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize), r != null && (k(e, r), this.variableNames.push("offset")), i != null && (k(e, i), this.variableNames.push("scale")), this.offsetShape = r, this.scaleShape = i, this.shaderKey = "batchNorm";
5291
5291
  }
5292
5292
  getUserCode() {
5293
5293
  let e = "0.0";
5294
5294
  this.offsetShape != null && (e = "getOffsetByOutputIndex(index)");
5295
5295
  let t = "1.0";
5296
5296
  return this.scaleShape != null && (t = "getScaleByOutputIndex(index)"), `
5297
- ${I("index")} {
5297
+ ${z("index")} {
5298
5298
  if (index < uniforms.size)
5299
5299
  {
5300
5300
  let xValue = getXByOutputIndex(index);
@@ -5391,12 +5391,12 @@ var Zc = {
5391
5391
  64,
5392
5392
  1,
5393
5393
  1
5394
- ], this.size = !0, this.outputShape = t, this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize), this.shaderKey = `gathernd_${e}`, this.sliceDim = e, this.uniforms = `sliceDim : i32, strides : ${F(e)},`;
5394
+ ], this.size = !0, this.outputShape = t, this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize), this.shaderKey = `gathernd_${e}`, this.sliceDim = e, this.uniforms = `sliceDim : i32, strides : ${R(e)},`;
5395
5395
  }
5396
5396
  getUserCode() {
5397
5397
  let e;
5398
5398
  return e = this.sliceDim > 1 ? "uniforms.strides[j]" : "uniforms.strides", `
5399
- ${I("index")} {
5399
+ ${z("index")} {
5400
5400
  if (index < uniforms.size) {
5401
5401
  let coords = getCoordsFromIndex(index);
5402
5402
  var flattenIndex = 0;
@@ -5451,12 +5451,12 @@ var el = {
5451
5451
  64,
5452
5452
  1,
5453
5453
  1
5454
- ], this.size = !0, this.outputShape = e.slice(), this.aShape = e, this.outputShape = t, this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize), this.shaderKey = "gather";
5454
+ ], this.size = !0, this.outputShape = e.slice(), this.aShape = e, this.outputShape = t, this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize), this.shaderKey = "gather";
5455
5455
  }
5456
5456
  getUserCode() {
5457
5457
  let e = nl(this.aShape);
5458
5458
  return `
5459
- ${I("index")} {
5459
+ ${z("index")} {
5460
5460
  if (index < uniforms.size) {
5461
5461
  let resRC = getCoordsFromIndex(index);
5462
5462
  let indexZ = i32(getIndices(resRC.x, resRC.z));
@@ -5602,11 +5602,11 @@ var pl = {
5602
5602
  64,
5603
5603
  1,
5604
5604
  1
5605
- ], this.size = !0, this.outputShape = [e], this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize), this.shaderKey = "linSpace";
5605
+ ], this.size = !0, this.outputShape = [e], this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize), this.shaderKey = "linSpace";
5606
5606
  }
5607
5607
  getUserCode() {
5608
5608
  return `
5609
- ${I("index")} {
5609
+ ${z("index")} {
5610
5610
  if (index < uniforms.size) {
5611
5611
  setOutputAtIndex(index, uniforms.start + f32(index) * uniforms.step);
5612
5612
  }
@@ -5662,11 +5662,11 @@ var vl = {
5662
5662
  64,
5663
5663
  1,
5664
5664
  1
5665
- ], this.size = !0, this.outputShape = e, this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize), this.shaderKey = "lrn";
5665
+ ], this.size = !0, this.outputShape = e, this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize), this.shaderKey = "lrn";
5666
5666
  }
5667
5667
  getUserCode() {
5668
5668
  return `
5669
- ${I("index")} {
5669
+ ${z("index")} {
5670
5670
  if (index < uniforms.size) {
5671
5671
  let coords = getOutputCoords();
5672
5672
  let b = coords[0];
@@ -5700,7 +5700,7 @@ var vl = {
5700
5700
  x: [3],
5701
5701
  y: [2],
5702
5702
  z: [0, 1]
5703
- }, this.dispatch = z(this.dispatchLayout, this.outputShape, [
5703
+ }, this.dispatch = F(this.dispatchLayout, this.outputShape, [
5704
5704
  this.elementsPerWorkgroup,
5705
5705
  this.workgroupSize[1],
5706
5706
  this.workgroupSize[2]
@@ -5712,7 +5712,7 @@ var vl = {
5712
5712
  const elementsPerWorkgroup = ${this.elementsPerWorkgroup};
5713
5713
  const maxAllowRadius = ${this.maxAllowRadius};
5714
5714
 
5715
- ${I()} {
5715
+ ${z()} {
5716
5716
  let localDepth = i32(localId.x);
5717
5717
  let workgroupDepth = i32(workgroupId.x) * elementsPerWorkgroup;
5718
5718
  let xDepth = workgroupDepth + localDepth - maxAllowRadius;
@@ -5781,11 +5781,11 @@ var Ol = {
5781
5781
  64,
5782
5782
  1,
5783
5783
  1
5784
- ], this.size = !0, this.outputShape = e, this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize), this.shaderKey = "lrn_grad";
5784
+ ], this.size = !0, this.outputShape = e, this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize), this.shaderKey = "lrn_grad";
5785
5785
  }
5786
5786
  getUserCode() {
5787
5787
  return `
5788
- ${I("index")} {
5788
+ ${z("index")} {
5789
5789
  if (index < uniforms.size) {
5790
5790
  let coords = getOutputCoords();
5791
5791
  let b = coords[0];
@@ -5940,11 +5940,11 @@ var Il = {
5940
5940
  64,
5941
5941
  1,
5942
5942
  1
5943
- ], this.size = !0, this.outputShape = e.inShape, this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize), this.shaderKey = "maxPool2DBackprop";
5943
+ ], this.size = !0, this.outputShape = e.inShape, this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize), this.shaderKey = "maxPool2DBackprop";
5944
5944
  }
5945
5945
  getUserCode() {
5946
5946
  return `
5947
- ${I("index")} {
5947
+ ${z("index")} {
5948
5948
  if (index < uniforms.size) {
5949
5949
  let coords = getCoordsFromIndex(index);
5950
5950
  let batch = coords[0];
@@ -5995,11 +5995,11 @@ var Il = {
5995
5995
  64,
5996
5996
  1,
5997
5997
  1
5998
- ], this.size = !0, this.outputShape = e.inShape, this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize), this.shaderKey = "maxPool3DBackprop";
5998
+ ], this.size = !0, this.outputShape = e.inShape, this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize), this.shaderKey = "maxPool3DBackprop";
5999
5999
  }
6000
6000
  getUserCode() {
6001
6001
  return `
6002
- ${I("index")} {
6002
+ ${z("index")} {
6003
6003
  if (index < uniforms.size) {
6004
6004
  let coords = getCoordsFromIndex(index);
6005
6005
  let batch = coords.x;
@@ -6149,7 +6149,7 @@ var Bl = {
6149
6149
  //#region node_modules/@tensorflow/tfjs-backend-webgpu/dist/kernels/MaxPoolGrad.js
6150
6150
  function Vl(e) {
6151
6151
  let { inputs: t, backend: n, attrs: r } = e, { dy: i, input: a, output: o } = t, s = a;
6152
- xr([a, o], "maxPoolGrad");
6152
+ _r([a, o], "maxPoolGrad");
6153
6153
  let { filterSize: c, strides: l, pad: u, dimRoundingMode: d } = r, f = S(s.shape, c, l, 1, u, d), p = new $a(f, "max", !0), m = [
6154
6154
  {
6155
6155
  type: "int32",
@@ -6265,19 +6265,19 @@ var Kl = {
6265
6265
  64,
6266
6266
  1,
6267
6267
  1
6268
- ], this.size = !0, this.outputShape = t.map((t, n) => t[0] + e[n] + t[1]), this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize), this.xShape = e, t.map((e, t) => {
6268
+ ], this.size = !0, this.outputShape = t.map((t, n) => t[0] + e[n] + t[1]), this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize), this.xShape = e, t.map((e, t) => {
6269
6269
  this.uniforms += ` pad${t} : vec2<i32>,`;
6270
6270
  }), this.offset = n === "reflect" ? 0 : 1, this.shaderKey = `mirrorPad_${n}`;
6271
6271
  }
6272
6272
  getUserCode() {
6273
- let e = this.xShape.length, t = this.xShape.map((e, t) => `uniforms.pad${t}[0]`).join(","), n = this.xShape.map((t, n) => `uniforms.pad${n}[0] + uniforms.xShape${e > 1 ? `[${n}]` : ""}`).join(","), r = e === 1 ? "start" : "start[i]", i = e === 1 ? "end" : "end[i]", a = e === 1 ? "outC" : "outC[i]", o = F(e), s = e > 1 ? [
6273
+ let e = this.xShape.length, t = this.xShape.map((e, t) => `uniforms.pad${t}[0]`).join(","), n = this.xShape.map((t, n) => `uniforms.pad${n}[0] + uniforms.xShape${e > 1 ? `[${n}]` : ""}`).join(","), r = e === 1 ? "start" : "start[i]", i = e === 1 ? "end" : "end[i]", a = e === 1 ? "outC" : "outC[i]", o = R(e), s = e > 1 ? [
6274
6274
  "coords[0]",
6275
6275
  "coords[1]",
6276
6276
  "coords[2]",
6277
6277
  "coords[3]"
6278
6278
  ].slice(0, e) : "coords";
6279
6279
  return `
6280
- ${I("index")} {
6280
+ ${z("index")} {
6281
6281
  if (index < uniforms.size) {
6282
6282
  let start = ${o}(${t});
6283
6283
  let end = ${o}(${n});
@@ -6315,7 +6315,7 @@ var Kl = {
6315
6315
  64,
6316
6316
  1,
6317
6317
  1
6318
- ], this.size = !0, this.outputShape = [e, t], this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize), this.shaderKey = "multinomial";
6318
+ ], this.size = !0, this.outputShape = [e, t], this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize), this.shaderKey = "multinomial";
6319
6319
  }
6320
6320
  getUserCode() {
6321
6321
  return `
@@ -6329,7 +6329,7 @@ var Kl = {
6329
6329
  return fract((p3.x + p3.y) * p3.z);
6330
6330
  }
6331
6331
 
6332
- ${I("index")} {
6332
+ ${z("index")} {
6333
6333
  if (index < uniforms.size) {
6334
6334
  let coords = getOutputCoords();
6335
6335
  let batch = coords[0];
@@ -6355,7 +6355,7 @@ var Kl = {
6355
6355
  }
6356
6356
  }, Ql = class {
6357
6357
  constructor(e) {
6358
- this.variableNames = ["logits"], this.outputShape = e, this.dispatchLayout = R(this.outputShape), this.dispatch = [
6358
+ this.variableNames = ["logits"], this.outputShape = e, this.dispatchLayout = P(this.outputShape), this.dispatch = [
6359
6359
  this.outputShape[0],
6360
6360
  1,
6361
6361
  1
@@ -6375,7 +6375,7 @@ var Kl = {
6375
6375
  var<workgroup> rowMaxShared : f32;
6376
6376
  var<workgroup> rowSumShared : f32;
6377
6377
  const blockSize = ${this.workgroupSize[0]};
6378
- ${I("index")} {
6378
+ ${z("index")} {
6379
6379
  let row = index / blockSize;
6380
6380
  let tid = i32(localId.x);
6381
6381
  let cols = uniforms.outShape[1];
@@ -6517,11 +6517,11 @@ var cu = {
6517
6517
  64,
6518
6518
  1,
6519
6519
  1
6520
- ], this.size = !0, this.outputShape = [e, t], this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize), this.shaderKey = "onehot";
6520
+ ], this.size = !0, this.outputShape = [e, t], this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize), this.shaderKey = "onehot";
6521
6521
  }
6522
6522
  getUserCode() {
6523
6523
  return `
6524
- ${I("index")} {
6524
+ ${z("index")} {
6525
6525
  if(index < uniforms.size) {
6526
6526
  let coords = getCoordsFromIndex(index);
6527
6527
  setOutputAtIndex(index, mix(uniforms.offValue, uniforms.onValue,
@@ -6672,7 +6672,7 @@ var _u = {
6672
6672
  //#endregion
6673
6673
  //#region node_modules/@tensorflow/tfjs-backend-webgpu/dist/pad_webgpu.js
6674
6674
  function vu(e, t = !1) {
6675
- let n = e.length, r = F(n), i = e.map((e, t) => `uniforms.pad${t}[0]`).join(","), a = e.map((e, t) => `uniforms.pad${t}[0] + uniforms.xShape${n > 1 ? `[${t}]` : ""}`).join(","), o = n > 1 ? `${r}(${i})` : `${i}`, s = n > 1 ? `${r}(${a})` : `${a}`, c = n > 1 ? "any(paddedCoords < start)" : "paddedCoords < start", l = n > 1 ? "any(paddedCoords >= end)" : "paddedCoords >= end", u = n > 1 ? [
6675
+ let n = e.length, r = R(n), i = e.map((e, t) => `uniforms.pad${t}[0]`).join(","), a = e.map((e, t) => `uniforms.pad${t}[0] + uniforms.xShape${n > 1 ? `[${t}]` : ""}`).join(","), o = n > 1 ? `${r}(${i})` : `${i}`, s = n > 1 ? `${r}(${a})` : `${a}`, c = n > 1 ? "any(paddedCoords < start)" : "paddedCoords < start", l = n > 1 ? "any(paddedCoords >= end)" : "paddedCoords >= end", u = n > 1 ? [
6676
6676
  "coords[0]",
6677
6677
  "coords[1]",
6678
6678
  "coords[2]",
@@ -6695,13 +6695,13 @@ var yu = class {
6695
6695
  64,
6696
6696
  1,
6697
6697
  1
6698
- ], this.size = !0, this.outputShape = t.map((t, n) => t[0] + e[n] + t[1]), this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize), t.map((e, t) => {
6698
+ ], this.size = !0, this.outputShape = t.map((t, n) => t[0] + e[n] + t[1]), this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize), t.map((e, t) => {
6699
6699
  this.uniforms += ` pad${t} : vec2<i32>,`;
6700
6700
  }), this.xShape = e, this.shaderKey = "pad";
6701
6701
  }
6702
6702
  getUserCode() {
6703
6703
  return `
6704
- ${I("index")} {
6704
+ ${z("index")} {
6705
6705
  if (index < uniforms.size) {
6706
6706
  let paddedCoords = getCoordsFromIndex(index);
6707
6707
  ${vu(this.xShape)}
@@ -6797,11 +6797,11 @@ var Tu = {
6797
6797
  t,
6798
6798
  n,
6799
6799
  e[3]
6800
- ], this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize), this.shaderKey = "resizeBilinear";
6800
+ ], this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize), this.shaderKey = "resizeBilinear";
6801
6801
  }
6802
6802
  getUserCode() {
6803
6803
  return `
6804
- ${I("index")} {
6804
+ ${z("index")} {
6805
6805
  if (index < uniforms.size) {
6806
6806
  let coords = getCoordsFromIndex(index);
6807
6807
  let b = coords[0];
@@ -6868,11 +6868,11 @@ var Nu = {
6868
6868
  64,
6869
6869
  1,
6870
6870
  1
6871
- ], this.size = !0, this.outputShape = e, this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize), this.alignCorners = t, this.shaderKey = `resizeBilinearBackprop_${t}`;
6871
+ ], this.size = !0, this.outputShape = e, this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize), this.alignCorners = t, this.shaderKey = `resizeBilinearBackprop_${t}`;
6872
6872
  }
6873
6873
  getUserCode() {
6874
6874
  return `
6875
- ${I("index")} {
6875
+ ${z("index")} {
6876
6876
  if (index < uniforms.size) {
6877
6877
  let coords = getOutputCoords();
6878
6878
  let b = coords[0];
@@ -7002,12 +7002,12 @@ var Iu = {
7002
7002
  t,
7003
7003
  n,
7004
7004
  e[3]
7005
- ], this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize), this.halfPixelCenters = r, this.shaderKey = `resizeNearest_${r}`;
7005
+ ], this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize), this.halfPixelCenters = r, this.shaderKey = `resizeNearest_${r}`;
7006
7006
  }
7007
7007
  getUserCode() {
7008
7008
  let e;
7009
7009
  return e = this.halfPixelCenters ? "max((vec2<f32>(rc) + vec2<f32>(0.5)) * effectiveInputOverOutputRatioRC, vec2<f32>(0.0))" : "vec2<f32>(rc) * effectiveInputOverOutputRatioRC", `
7010
- ${I("index")} {
7010
+ ${z("index")} {
7011
7011
  if (index < uniforms.size) {
7012
7012
  let coords = getCoordsFromIndex(index);
7013
7013
  let b = coords[0];
@@ -7062,11 +7062,11 @@ var zu = {
7062
7062
  64,
7063
7063
  1,
7064
7064
  1
7065
- ], this.size = !0, this.outputShape = e, this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize), this.alignCorners = t, this.shaderKey = `resizeNearestNeigborBackprop_${t}`;
7065
+ ], this.size = !0, this.outputShape = e, this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize), this.alignCorners = t, this.shaderKey = `resizeNearestNeigborBackprop_${t}`;
7066
7066
  }
7067
7067
  getUserCode() {
7068
7068
  return `
7069
- ${I("index")} {
7069
+ ${z("index")} {
7070
7070
  if (index < uniforms.size) {
7071
7071
  let coords = getOutputCoords();
7072
7072
  let b = coords[0];
@@ -7168,7 +7168,7 @@ var Hu = {
7168
7168
  64,
7169
7169
  1,
7170
7170
  1
7171
- ], this.size = !0, this.outputShape = e, this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize), this.uniforms = " axis : vec4<i32>,", this.shaderKey = "reverse";
7171
+ ], this.size = !0, this.outputShape = e, this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize), this.uniforms = " axis : vec4<i32>,", this.shaderKey = "reverse";
7172
7172
  }
7173
7173
  getUserCode() {
7174
7174
  return `
@@ -7193,7 +7193,7 @@ var Hu = {
7193
7193
  return reverseCoords;
7194
7194
  }
7195
7195
 
7196
- ${I("index")} {
7196
+ ${z("index")} {
7197
7197
  if (index < uniforms.size) {
7198
7198
  let coords = getCoordsFromIndex(index);
7199
7199
  let reverseCoords = getReverseCoords(coords);
@@ -7258,11 +7258,11 @@ var Gu = {
7258
7258
  64,
7259
7259
  1,
7260
7260
  1
7261
- ], this.size = !0, this.outputShape = e, this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize), this.uniforms = "centerX : f32, centerY : f32, sinRadians : f32,\n cosRadians : f32,", this.shaderKey = "rotate", this.outputShape = e, typeof t == "number" ? (this.uniforms += " fillValue : f32,", this.fillSnippet = "var outputValue = uniforms.fillValue;", this.shaderKey += "_float") : (this.uniforms += " fillValue : vec3<f32>,", this.fillSnippet = "var outputValue = uniforms.fillValue[coords[3]];", this.shaderKey += "_vec3");
7261
+ ], this.size = !0, this.outputShape = e, this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize), this.uniforms = "centerX : f32, centerY : f32, sinRadians : f32,\n cosRadians : f32,", this.shaderKey = "rotate", this.outputShape = e, typeof t == "number" ? (this.uniforms += " fillValue : f32,", this.fillSnippet = "var outputValue = uniforms.fillValue;", this.shaderKey += "_float") : (this.uniforms += " fillValue : vec3<f32>,", this.fillSnippet = "var outputValue = uniforms.fillValue[coords[3]];", this.shaderKey += "_vec3");
7262
7262
  }
7263
7263
  getUserCode() {
7264
7264
  return `
7265
- ${I("index")} {
7265
+ ${z("index")} {
7266
7266
  if (index < uniforms.size) {
7267
7267
  let coords = getCoordsFromIndex(index);
7268
7268
  let coordXFloat = (f32(coords[2]) - uniforms.centerX) *
@@ -7330,8 +7330,8 @@ var Gu = {
7330
7330
  64,
7331
7331
  1,
7332
7332
  1
7333
- ], this.atomic = !0, this.outputShape = a, this.type = o, this.sumDupeIndices = s, this.dispatchLayout = R(e), this.dispatch = z(this.dispatchLayout, e, this.workgroupSize), this.sliceDimGreaterThanOne = t > 1, this.shaderKey = `scatter_${n}_${r}_${this.sliceDimGreaterThanOne}_${o}_${s}_${i.length}`;
7334
- let c = F(i.length);
7333
+ ], this.atomic = !0, this.outputShape = a, this.type = o, this.sumDupeIndices = s, this.dispatchLayout = P(e), this.dispatch = F(this.dispatchLayout, e, this.workgroupSize), this.sliceDimGreaterThanOne = t > 1, this.shaderKey = `scatter_${n}_${r}_${this.sliceDimGreaterThanOne}_${o}_${s}_${i.length}`;
7334
+ let c = R(i.length);
7335
7335
  this.uniforms = `sliceDim : i32, strides: ${c}, updatesSize: i32,`, this.updatesRank = r, this.indicesRank = n;
7336
7336
  }
7337
7337
  getUserCode() {
@@ -7342,7 +7342,7 @@ var Gu = {
7342
7342
  let a = `getUpdates(${Array.from({ length: this.updatesRank }, (e, t) => `coords[${t}]`).join(", ")})`;
7343
7343
  return `
7344
7344
  ${i}
7345
- ${I("index")} {
7345
+ ${z("index")} {
7346
7346
  if (index < uniforms.updatesSize) {
7347
7347
  let coords = getUpdatesCoordsFromFlatIndex(index);
7348
7348
  var flattenedIndex = 0;
@@ -7351,10 +7351,10 @@ var Gu = {
7351
7351
  flattenedIndex = flattenedIndex + indexInside * ${n};
7352
7352
  }
7353
7353
  let updateValue =
7354
- ${gr(this.type)}(${a});
7354
+ ${Sr(this.type)}(${a});
7355
7355
  let flatIndex = getOutputIndexFromCoords(${r});
7356
7356
 
7357
- ${this.sumDupeIndices ? P("&result[flatIndex]", "updateValue", this.type) : "atomicStore(&result[flatIndex], bitcast<i32>(updateValue));"}
7357
+ ${this.sumDupeIndices ? L("&result[flatIndex]", "updateValue", this.type) : "atomicStore(&result[flatIndex], bitcast<i32>(updateValue));"}
7358
7358
  }
7359
7359
  }`;
7360
7360
  }
@@ -7409,7 +7409,7 @@ var Qu = {
7409
7409
  64,
7410
7410
  1,
7411
7411
  1
7412
- ], this.size = !0, this.outputShape = e, this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize), this.side = t, this.shaderKey = `search_sorted_${t}`;
7412
+ ], this.size = !0, this.outputShape = e, this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize), this.side = t, this.shaderKey = `search_sorted_${t}`;
7413
7413
  }
7414
7414
  getUserCode() {
7415
7415
  return `
@@ -7427,7 +7427,7 @@ var Qu = {
7427
7427
  return right;
7428
7428
  }
7429
7429
 
7430
- ${I("index")} {
7430
+ ${z("index")} {
7431
7431
  if (index < uniforms.size) {
7432
7432
  let coords = getCoordsFromIndex(index);
7433
7433
  let value = getValuesByOutputIndex(index);
@@ -7460,7 +7460,7 @@ var td = {
7460
7460
  64,
7461
7461
  1,
7462
7462
  1
7463
- ], this.size = !0, this.outputShape = t, this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize), this.cRank = e, this.rank = n, this.shaderKey = "select";
7463
+ ], this.size = !0, this.outputShape = t, this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize), this.cRank = e, this.rank = n, this.shaderKey = "select";
7464
7464
  }
7465
7465
  getUserCode() {
7466
7466
  let e, t;
@@ -7477,7 +7477,7 @@ var td = {
7477
7477
  e = r.join(), t = i.join();
7478
7478
  }
7479
7479
  return `
7480
- ${I("index")} {
7480
+ ${z("index")} {
7481
7481
  if (index < uniforms.size) {
7482
7482
  let resRC = getCoordsFromIndex(index);
7483
7483
  let cVal = getC(${e});
@@ -7538,15 +7538,15 @@ var id = {
7538
7538
  ], this.size = !0;
7539
7539
  let o = Array(r.length);
7540
7540
  for (let e = 0; e < o.length; e++) o[e] = r[i[e]];
7541
- this.outputShape = o, this.newDim = i, this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize), this.xShape = e, this.paddedXShape = t, this.uniforms += `reshapedPaddedXShape : ${F(r.length)}, paddedXShapeStrides : ${F(a)}, `, n.map((e, t) => {
7541
+ this.outputShape = o, this.newDim = i, this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize), this.xShape = e, this.paddedXShape = t, this.uniforms += `reshapedPaddedXShape : ${R(r.length)}, paddedXShapeStrides : ${R(a)}, `, n.map((e, t) => {
7542
7542
  this.uniforms += ` pad${t} : vec2<i32>,`;
7543
7543
  }), this.shaderKey = `spaceToBatchND_${i}`;
7544
7544
  }
7545
7545
  getUserCode() {
7546
- let e = F(this.outputShape.length), t = Pa(this.newDim);
7546
+ let e = R(this.outputShape.length), t = Pa(this.newDim);
7547
7547
  return `
7548
- ${mr(this.paddedXShape, "PaddedX")}
7549
- ${I("index")} {
7548
+ ${br(this.paddedXShape, "PaddedX")}
7549
+ ${z("index")} {
7550
7550
  if(index < uniforms.size) {
7551
7551
  let coords = getCoordsFromIndex(index);
7552
7552
  let switchedIndex = getIndexFromCoords${this.outputShape.length}D(${e}(${t}), uniforms.reshapedPaddedXShape);
@@ -7593,11 +7593,11 @@ var id = {
7593
7593
  64,
7594
7594
  1,
7595
7595
  1
7596
- ], this.atomic = !0, this.outputShape = e, this.type = n, this.dispatchLayout = R([t]), this.dispatch = z(this.dispatchLayout, [t], this.workgroupSize), this.shaderKey = "sparseSegmentSum";
7596
+ ], this.atomic = !0, this.outputShape = e, this.type = n, this.dispatchLayout = P([t]), this.dispatch = F(this.dispatchLayout, [t], this.workgroupSize), this.shaderKey = "sparseSegmentSum";
7597
7597
  }
7598
7598
  getUserCode() {
7599
7599
  return `
7600
- ${I("index")} {
7600
+ ${z("index")} {
7601
7601
  if (index < uniforms.sparseSize) {
7602
7602
  let indexInSegmentIds = index / uniforms.segmentSize;
7603
7603
  let indexInSegment = index % uniforms.segmentSize;
@@ -7606,7 +7606,7 @@ var id = {
7606
7606
 
7607
7607
  let value = input[indexInInput * uniforms.segmentSize + indexInSegment];
7608
7608
  let outIndex = segmentId * uniforms.segmentSize + indexInSegment;
7609
- ${P("&result[outIndex]", "value", this.type)}
7609
+ ${L("&result[outIndex]", "value", this.type)}
7610
7610
  }
7611
7611
  }
7612
7612
  `;
@@ -7617,14 +7617,14 @@ var id = {
7617
7617
  64,
7618
7618
  1,
7619
7619
  1
7620
- ], this.atomic = !0, this.outputShape = [e], this.dispatchLayout = R(t), this.dispatch = z(this.dispatchLayout, t, this.workgroupSize), this.shaderKey = "sparseSegmentIdCountProgram";
7620
+ ], this.atomic = !0, this.outputShape = [e], this.dispatchLayout = P(t), this.dispatch = F(this.dispatchLayout, t, this.workgroupSize), this.shaderKey = "sparseSegmentIdCountProgram";
7621
7621
  }
7622
7622
  getUserCode() {
7623
7623
  return `
7624
- ${I("index")} {
7624
+ ${z("index")} {
7625
7625
  if (index < uniforms.segmentIdsShape) {
7626
7626
  let segmentId = segmentIds[index];
7627
- ${P("&result[segmentId]", "1", "int32")}
7627
+ ${L("&result[segmentId]", "1", "int32")}
7628
7628
  }
7629
7629
  }
7630
7630
  `;
@@ -7635,11 +7635,11 @@ var id = {
7635
7635
  64,
7636
7636
  1,
7637
7637
  1
7638
- ], this.size = !0, this.outputShape = e, this.type = t, this.dispatchLayout = R(e), this.dispatch = z(this.dispatchLayout, e, this.workgroupSize), this.shaderKey = "sparseSegmentMean";
7638
+ ], this.size = !0, this.outputShape = e, this.type = t, this.dispatchLayout = P(e), this.dispatch = F(this.dispatchLayout, e, this.workgroupSize), this.shaderKey = "sparseSegmentMean";
7639
7639
  }
7640
7640
  getUserCode() {
7641
7641
  return `
7642
- ${I("index")} {
7642
+ ${z("index")} {
7643
7643
  if (index < uniforms.size) {
7644
7644
  let segmentId = index / uniforms.segmentSize;
7645
7645
  let count = sameSegmentIdCount[segmentId];
@@ -7731,12 +7731,12 @@ var bd = {
7731
7731
  ], this.size = !0;
7732
7732
  let n = Array(e.length);
7733
7733
  for (let r = 0; r < n.length; r++) n[r] = e[r] * t[r];
7734
- this.outputShape = n, this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize), this.rank = this.outputShape.length, this.shaderKey = "tile";
7734
+ this.outputShape = n, this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize), this.rank = this.outputShape.length, this.shaderKey = "tile";
7735
7735
  }
7736
7736
  getUserCode() {
7737
7737
  let e = Sd(this.rank, "uniforms.");
7738
7738
  return `
7739
- ${I("index")} {
7739
+ ${z("index")} {
7740
7740
  if (index < uniforms.size) {
7741
7741
  let resRC = getCoordsFromIndex(index);
7742
7742
  setOutputAtIndex(index, getA(${e}));
@@ -7901,12 +7901,12 @@ var Nd = {
7901
7901
  64,
7902
7902
  1,
7903
7903
  1
7904
- ], this.size = !0, this.outputShape = e, this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize, [
7904
+ ], this.size = !0, this.outputShape = e, this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize, [
7905
7905
  this.workPerThread,
7906
7906
  1,
7907
7907
  1
7908
7908
  ]);
7909
- let t = F(this.outputShape.length);
7909
+ let t = R(this.outputShape.length);
7910
7910
  this.uniforms = `begin : ${t}, strides : ${t}, `, this.shaderKey = "stridedSlice";
7911
7911
  }
7912
7912
  getUserCode() {
@@ -7917,7 +7917,7 @@ var Nd = {
7917
7917
  t = this.outputShape.map((t, n) => (e++, this.outputShape.length === 1 ? `coords * uniforms.strides[${n}] + uniforms.begin[${n}]` : `coords[${e - 1}] * uniforms.strides[${n}] + uniforms.begin[${n}]`)).join(",");
7918
7918
  }
7919
7919
  return `
7920
- ${I("index")} {
7920
+ ${z("index")} {
7921
7921
  if (index < uniforms.size) {
7922
7922
  let coords = getCoordsFromIndex(index);
7923
7923
  setOutputAtIndex(index, getX(${t}));
@@ -8060,11 +8060,11 @@ var Ud = {
8060
8060
  256,
8061
8061
  1,
8062
8062
  1
8063
- ], this.size = !0, this.outputShape = e, this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize), this.uniforms = "inputSize : i32, firstPass : i32, negativeInf : f32,\n dir : i32, inc : i32,", this.shaderKey = "swap";
8063
+ ], this.size = !0, this.outputShape = e, this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize), this.uniforms = "inputSize : i32, firstPass : i32, negativeInf : f32,\n dir : i32, inc : i32,", this.shaderKey = "swap";
8064
8064
  }
8065
8065
  getUserCode() {
8066
8066
  return `
8067
- ${I("index")} {
8067
+ ${z("index")} {
8068
8068
  if (index < uniforms.size) {
8069
8069
  let outC = getCoordsFromIndex(index);
8070
8070
  let batch = outC[0];
@@ -8138,11 +8138,11 @@ var Ud = {
8138
8138
  256,
8139
8139
  1,
8140
8140
  1
8141
- ], this.size = !0, this.outputShape = e, this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize), this.uniforms = "inputSize : i32, firstPass : i32, k : i32,", this.shaderKey = "merge";
8141
+ ], this.size = !0, this.outputShape = e, this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize), this.uniforms = "inputSize : i32, firstPass : i32, k : i32,", this.shaderKey = "merge";
8142
8142
  }
8143
8143
  getUserCode() {
8144
8144
  return `
8145
- ${I("index")} {
8145
+ ${z("index")} {
8146
8146
  if (index < uniforms.size) {
8147
8147
  let outC = getCoordsFromIndex(index);
8148
8148
  let batch = outC[0];
@@ -8324,7 +8324,7 @@ var Yd = {
8324
8324
  64,
8325
8325
  1,
8326
8326
  1
8327
- ], this.size = !0, this.outputShape = e, this.dispatchLayout = R(this.outputShape), this.dispatch = z(this.dispatchLayout, this.outputShape, this.workgroupSize), this.shaderKey = "transform";
8327
+ ], this.size = !0, this.outputShape = e, this.dispatchLayout = P(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize), this.shaderKey = "transform";
8328
8328
  }
8329
8329
  getUserCode() {
8330
8330
  return `
@@ -8391,7 +8391,7 @@ var Yd = {
8391
8391
  return outputValue;
8392
8392
  }
8393
8393
 
8394
- ${I("index")} {
8394
+ ${z("index")} {
8395
8395
  if (index < uniforms.size) {
8396
8396
  let coords = getCoordsFromIndex(index);
8397
8397
  var outputValue : f32;
@@ -8531,13 +8531,13 @@ var ef = {
8531
8531
  64,
8532
8532
  1,
8533
8533
  1
8534
- ], this.atomic = !0, this.outputShape = t, this.dispatchLayout = R(e), this.dispatch = z(this.dispatchLayout, e, this.workgroupSize), n !== "float32" && n !== "int32") throw Error(`UnsortedSegmentSum only supports float32 and int32
8534
+ ], this.atomic = !0, this.outputShape = t, this.dispatchLayout = P(e), this.dispatch = F(this.dispatchLayout, e, this.workgroupSize), n !== "float32" && n !== "int32") throw Error(`UnsortedSegmentSum only supports float32 and int32
8535
8535
  types, does not support ${n} type.`);
8536
8536
  this.type = n, this.shaderKey = "unsortedSegmentSum";
8537
8537
  }
8538
8538
  getUserCode() {
8539
8539
  return `
8540
- ${I("index")} {
8540
+ ${z("index")} {
8541
8541
  if (index < uniforms.xSize) {
8542
8542
  let coords = getXCoordsFromIndex(index);
8543
8543
  let b = coords[0];
@@ -8548,7 +8548,7 @@ var ef = {
8548
8548
  let flatIndex = b * uniforms.numSegments + segmentId % uniforms.numSegments;
8549
8549
  let value = getX(b, inCol);
8550
8550
 
8551
- ${P("&result[flatIndex]", "value", this.type)}
8551
+ ${L("&result[flatIndex]", "value", this.type)}
8552
8552
  }
8553
8553
  }
8554
8554
  }