@genai-fi/nanogpt 0.6.3 → 0.7.1
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.
- package/dist/Generator.js +17 -13
- package/dist/NanoGPTModel.d.ts +2 -2
- package/dist/NanoGPTModel.js +104 -136
- package/dist/{RealDiv-BYViZwhN.js → RealDiv-CVYNbZxu.js} +30 -29
- package/dist/{Reshape-t7Kcikjk.js → Reshape-CEsEp0AI.js} +5 -5
- package/dist/Reshape-Do18N3gO.js +30 -0
- package/dist/TeachableLLM.js +9 -5
- package/dist/{TiedEmbedding-9WeDwvjO.js → TiedEmbedding-ccLBFiZi.js} +4 -4
- package/dist/{axis_util-Bu4h7XWV.js → axis_util-5DTW2tFV.js} +3 -3
- package/dist/backend.d.ts +1 -0
- package/dist/backend.js +7 -0
- package/dist/backend_util-C9Ut8n0Q.js +749 -0
- package/dist/{broadcast_to-DARN-DBD.js → broadcast_to-Ba9h_8DO.js} +2 -2
- package/dist/{concat-5aPGqw3Z.js → concat-CbXTetof.js} +8 -8
- package/dist/{dataset-pgqp-YfL.js → dataset-U3PrjwgU.js} +7 -7
- package/dist/{dropout-Bciw46HT.js → dropout-DPfPgWWe.js} +8 -8
- package/dist/{gather-DjyCjmOD.js → gather-Bbh8DHhM.js} +1 -1
- package/dist/gelu-BFwVnd1r.js +26 -0
- package/dist/gpgpu_math-DffelNS-.js +2371 -0
- package/dist/index-DYD_yPa-.js +12076 -0
- package/dist/{index-BAzbokzv.js → index-UdZhlibC.js} +414 -398
- package/dist/{kernel_funcs_utils-CUxJCg0g.js → kernel_funcs_utils-CXDy3EN7.js} +31 -30
- package/dist/layers/BaseLayer.js +2 -2
- package/dist/layers/CausalSelfAttention.js +8 -8
- package/dist/layers/MLP.js +5 -5
- package/dist/layers/RMSNorm.js +3 -3
- package/dist/layers/RoPECache.js +4 -4
- package/dist/layers/TiedEmbedding.js +5 -5
- package/dist/layers/TransformerBlock.js +1 -1
- package/dist/loader/loadTransformers.js +1 -1
- package/dist/loader/oldZipLoad.js +11 -7
- package/dist/{log_sum_exp-YEo2h3gb.js → log_sum_exp-BnmCkHWl.js} +16 -16
- package/dist/main.d.ts +13 -0
- package/dist/main.js +44 -23
- package/dist/{mat_mul-7121rsJk.js → mat_mul-dwmZz69e.js} +4 -4
- package/dist/{max-DtlIuVeW.js → max-ByjEGoFx.js} +3 -3
- package/dist/{mulmat_packed_gpu-D4nKF7Je.js → mulmat_packed_gpu-IGPBp6h9.js} +1 -1
- package/dist/non_max_suppression_impl-CsEgBuMA.js +134 -0
- package/dist/{ones-BBlSRqn1.js → ones-C8Mfln6-.js} +2 -2
- package/dist/ops/adamAdjust.d.ts +2 -0
- package/dist/ops/adamAdjust.js +9 -0
- package/dist/ops/adamMoments.d.ts +2 -0
- package/dist/ops/adamMoments.js +9 -0
- package/dist/ops/appendCache.js +3 -3
- package/dist/ops/attentionMask.js +1 -1
- package/dist/ops/cpu/adamAdjust.d.ts +1 -0
- package/dist/ops/cpu/adamAdjust.js +18 -0
- package/dist/ops/cpu/adamMoments.d.ts +1 -0
- package/dist/ops/cpu/adamMoments.js +16 -0
- package/dist/ops/cpu/appendCache.js +8 -8
- package/dist/ops/cpu/attentionMask.js +9 -9
- package/dist/ops/cpu/fusedSoftmax.js +17 -11
- package/dist/ops/cpu/gatherSub.js +7 -7
- package/dist/ops/cpu/gelu.js +13 -13
- package/dist/ops/cpu/matMulGelu.js +36 -24
- package/dist/ops/cpu/matMulMul.js +14 -8
- package/dist/ops/cpu/mulDropout.js +9 -3
- package/dist/ops/cpu/normRMS.js +5 -5
- package/dist/ops/cpu/qkv.js +3 -3
- package/dist/ops/cpu/rope.js +5 -5
- package/dist/ops/cpu/scatterSub.js +11 -11
- package/dist/ops/fusedSoftmax.js +1 -1
- package/dist/ops/gatherSub.js +1 -1
- package/dist/ops/gelu.js +2 -2
- package/dist/ops/grads/attentionMask.js +1 -1
- package/dist/ops/grads/fusedSoftmax.js +2 -2
- package/dist/ops/grads/gelu.js +3 -24
- package/dist/ops/grads/matMulGelu.js +5 -5
- package/dist/ops/grads/normRMS.js +6 -6
- package/dist/ops/grads/qkv.js +1 -1
- package/dist/ops/grads/rope.js +3 -3
- package/dist/ops/matMulGelu.js +1 -1
- package/dist/ops/matMulMul.js +1 -1
- package/dist/ops/mulDrop.js +1 -1
- package/dist/ops/normRMS.js +1 -1
- package/dist/ops/qkv.js +1 -1
- package/dist/ops/rope.js +4 -4
- package/dist/ops/scatterSub.js +1 -1
- package/dist/ops/webgl/adamAdjust.d.ts +1 -0
- package/dist/ops/webgl/adamAdjust.js +50 -0
- package/dist/ops/webgl/adamMoments.d.ts +1 -0
- package/dist/ops/webgl/adamMoments.js +38 -0
- package/dist/ops/webgl/appendCache.js +1 -1
- package/dist/ops/webgl/attentionMask.js +1 -1
- package/dist/ops/webgl/fusedSoftmax.js +4 -4
- package/dist/ops/webgl/gatherSub.js +8 -8
- package/dist/ops/webgl/gelu.js +2 -2
- package/dist/ops/webgl/log.js +5 -5
- package/dist/ops/webgl/matMulGelu.js +17 -17
- package/dist/ops/webgl/matMulMul.js +1 -1
- package/dist/ops/webgl/mulDropout.js +4 -4
- package/dist/ops/webgl/normRMS.js +2 -2
- package/dist/ops/webgl/qkv.js +1 -1
- package/dist/ops/webgl/rope.js +1 -1
- package/dist/ops/webgl/scatterSub.js +1 -1
- package/dist/ops/webgpu/adamAdjust.d.ts +1 -0
- package/dist/ops/webgpu/adamAdjust.js +52 -0
- package/dist/ops/webgpu/adamMoments.d.ts +1 -0
- package/dist/ops/webgpu/adamMoments.js +51 -0
- package/dist/ops/webgpu/appendCache.d.ts +1 -0
- package/dist/ops/webgpu/appendCache.js +57 -0
- package/dist/ops/webgpu/attentionMask.d.ts +1 -0
- package/dist/ops/webgpu/attentionMask.js +65 -0
- package/dist/ops/webgpu/gatherSub.d.ts +1 -0
- package/dist/ops/webgpu/gatherSub.js +52 -0
- package/dist/ops/webgpu/gelu.d.ts +14 -0
- package/dist/ops/webgpu/gelu.js +87 -0
- package/dist/ops/webgpu/index.d.ts +0 -0
- package/dist/ops/webgpu/index.js +11 -0
- package/dist/ops/webgpu/normRMS.d.ts +1 -0
- package/dist/ops/webgpu/normRMS.js +41 -0
- package/dist/ops/webgpu/normRMSGrad.d.ts +1 -0
- package/dist/ops/webgpu/normRMSGrad.js +128 -0
- package/dist/ops/webgpu/qkv.d.ts +1 -0
- package/dist/ops/webgpu/qkv.js +57 -0
- package/dist/ops/webgpu/rope.d.ts +1 -0
- package/dist/ops/webgpu/rope.js +69 -0
- package/dist/ops/webgpu/scatterSub.d.ts +1 -0
- package/dist/ops/webgpu/scatterSub.js +38 -0
- package/dist/ops/webgpu/utils/reductions.d.ts +9 -0
- package/dist/ops/webgpu/utils/reductions.js +68 -0
- package/dist/{ops-C0sQEcPw.js → ops-aRTXR2Sr.js} +433 -508
- package/dist/{random_width-DWzaOgrn.js → random_width-DbSpgl4o.js} +144 -144
- package/dist/{range-DYsrnfiy.js → range-D9CZhVlR.js} +1 -1
- package/dist/{reciprocal-CJQeasVa.js → reciprocal-CGB48wZB.js} +1 -1
- package/dist/{register_all_kernels-BfFCQAqs.js → register_all_kernels-DnbAyBXt.js} +203 -200
- package/dist/{reshape-krWGKraP.js → reshape-BR0eoLYN.js} +1 -1
- package/dist/{scatter_nd_util-93ln7Hut.js → scatter_nd_util-OjyAxku2.js} +3 -3
- package/dist/{selu_util-sntGesxr.js → selu_util-Ce6pu9IM.js} +44 -44
- package/dist/{shared-Ca6iDobD.js → shared-Czipaeb6.js} +541 -606
- package/dist/shared-DS5waSIY.js +69 -0
- package/dist/{sin-D_h-qCSx.js → sin-CiBxrDqX.js} +1 -1
- package/dist/slice-BHbDHObE.js +28 -0
- package/dist/{softmax-fsdtf6JC.js → softmax-JMEIUo2J.js} +1 -1
- package/dist/{split-eiktj-6L.js → split-CRU0PjVV.js} +4 -4
- package/dist/{stack-dfEEz2OY.js → stack-ikk2Y8_P.js} +2 -2
- package/dist/{sum-BE_Irnim.js → sum-NLYbiDag.js} +3 -3
- package/dist/{tensor-Xyi595sG.js → tensor-Do9PKbIE.js} +1 -1
- package/dist/{tensor2d-CPEkynbH.js → tensor2d-CWHxHpLh.js} +1 -1
- package/dist/training/Adam.d.ts +22 -0
- package/dist/training/Adam.js +93 -0
- package/dist/training/AdamExt.d.ts +1 -1
- package/dist/training/AdamExt.js +13 -12
- package/dist/training/DatasetBuilder.js +2 -2
- package/dist/training/Evaluator.js +1 -1
- package/dist/training/FullTrainer.js +27 -27
- package/dist/training/Trainer.d.ts +5 -6
- package/dist/training/Trainer.js +54 -55
- package/dist/training/sparseCrossEntropy.d.ts +0 -4
- package/dist/training/sparseCrossEntropy.js +7 -7
- package/dist/utilities/arrayClose.d.ts +1 -0
- package/dist/utilities/arrayClose.js +11 -0
- package/dist/utilities/dummy.js +19 -19
- package/dist/utilities/generate.js +15 -16
- package/dist/utilities/multinomialCPU.d.ts +2 -0
- package/dist/utilities/multinomialCPU.js +13 -0
- package/dist/utilities/performance.d.ts +2 -0
- package/dist/utilities/performance.js +16 -0
- package/dist/utilities/profile.d.ts +1 -0
- package/dist/utilities/profile.js +9 -6
- package/dist/utilities/safetensors.js +2 -2
- package/dist/utilities/weights.js +2 -2
- package/dist/{variable-wSS22xj5.js → variable-BTBkayv_.js} +1 -1
- package/dist/webgpu_program-WaoMq-WD.js +548 -0
- package/dist/webgpu_util-DhSeP4b6.js +80 -0
- package/dist/{zeros-YJDE7oRb.js → zeros-DnPT2nD4.js} +10 -10
- package/package.json +2 -1
- package/dist/gpgpu_math-CNslybmD.js +0 -3115
- package/dist/norm-CzltS9Fz.js +0 -86
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { j as p, a1 as w } from "./index-UdZhlibC.js";
|
|
2
2
|
function k(o, t, r) {
|
|
3
3
|
const n = t.rank > 1 ? t.shape[t.rank - 1] : 1, e = t.rank > 1 ? t.rank - 1 : 1, h = `Must have updates.shape = indices.shape[:batchDim] + shape[sliceDim:], got updates.shape: ${r.shape}, indices.shape: ${t.shape}, shape: ${o}, sliceDim: ${n}, and batchDim: ${e}.`;
|
|
4
4
|
if (r.rank < e)
|
|
@@ -31,7 +31,7 @@ function $(o, t, r) {
|
|
|
31
31
|
}
|
|
32
32
|
k(r, t, o);
|
|
33
33
|
}
|
|
34
|
-
function
|
|
34
|
+
function m(o, t, r) {
|
|
35
35
|
const n = t.shape.length, e = n > 1 ? t.shape[n - 1] : 1, h = r.length;
|
|
36
36
|
let a = 1;
|
|
37
37
|
for (let s = e; s < h; ++s)
|
|
@@ -41,6 +41,6 @@ function g(o, t, r) {
|
|
|
41
41
|
}
|
|
42
42
|
export {
|
|
43
43
|
k as a,
|
|
44
|
-
|
|
44
|
+
m as c,
|
|
45
45
|
$ as v
|
|
46
46
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { r as ce } from "./reshape-
|
|
3
|
-
import { s as ae } from "./sum-
|
|
1
|
+
import { l as N, aq as H, B as _, C as S, E as L, ar as te, as as ne, an as se, ap as re, at as ie, au as oe, av as le, a as ue, aw as fe, ax as O } from "./index-UdZhlibC.js";
|
|
2
|
+
import { r as ce } from "./reshape-BR0eoLYN.js";
|
|
3
|
+
import { s as ae } from "./sum-NLYbiDag.js";
|
|
4
4
|
/**
|
|
5
5
|
* @license
|
|
6
6
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
@@ -17,11 +17,11 @@ import { s as ae } from "./sum-BE_Irnim.js";
|
|
|
17
17
|
* limitations under the License.
|
|
18
18
|
* =============================================================================
|
|
19
19
|
*/
|
|
20
|
-
function
|
|
20
|
+
function Be(e, t, n, s, r = "NHWC", u) {
|
|
21
21
|
const i = e[3], o = [...t, i], c = Ae(r);
|
|
22
|
-
return
|
|
22
|
+
return B(e, o, n, u, s, null, null, c);
|
|
23
23
|
}
|
|
24
|
-
function
|
|
24
|
+
function Xe(e, t, n, s, r, u, i = "channelsLast") {
|
|
25
25
|
const [o, c] = T(t);
|
|
26
26
|
let a;
|
|
27
27
|
if (i === "channelsLast")
|
|
@@ -30,7 +30,7 @@ function Be(e, t, n, s, r, u, i = "channelsLast") {
|
|
|
30
30
|
a = [o, c, e[1], e[1]];
|
|
31
31
|
else
|
|
32
32
|
throw new Error(`Unknown dataFormat ${i}`);
|
|
33
|
-
return
|
|
33
|
+
return B(e, a, n, s, r, u, !1, i);
|
|
34
34
|
}
|
|
35
35
|
function je(e, t, n, s, r, u, i = "NDHWC") {
|
|
36
36
|
const [o, c, a] = W(t);
|
|
@@ -43,7 +43,7 @@ function je(e, t, n, s, r, u, i = "NDHWC") {
|
|
|
43
43
|
throw new Error(`Unknown dataFormat ${i}`);
|
|
44
44
|
return he(e, p, n, s, r, !1, g, u);
|
|
45
45
|
}
|
|
46
|
-
function
|
|
46
|
+
function B(e, t, n, s, r, u, i = !1, o = "channelsLast") {
|
|
47
47
|
let [c, a, p, g] = [-1, -1, -1, -1];
|
|
48
48
|
if (o === "channelsLast")
|
|
49
49
|
[c, a, p, g] = e;
|
|
@@ -51,7 +51,7 @@ function X(e, t, n, s, r, u, i = !1, o = "channelsLast") {
|
|
|
51
51
|
[c, g, a, p] = e;
|
|
52
52
|
else
|
|
53
53
|
throw new Error(`Unknown dataFormat ${o}`);
|
|
54
|
-
const [l, h, , d] = t, [A, m] = T(n), [b, k] = T(s), f = G(l, b),
|
|
54
|
+
const [l, h, , d] = t, [A, m] = T(n), [b, k] = T(s), f = G(l, b), w = G(h, k), { padInfo: E, outHeight: I, outWidth: x } = de(r, a, p, A, m, f, w, u, o), y = i ? d * g : d;
|
|
55
55
|
let $;
|
|
56
56
|
return o === "channelsFirst" ? $ = [c, y, I, x] : o === "channelsLast" && ($ = [c, I, x, y]), {
|
|
57
57
|
batchSize: c,
|
|
@@ -62,13 +62,13 @@ function X(e, t, n, s, r, u, i = !1, o = "channelsLast") {
|
|
|
62
62
|
outHeight: I,
|
|
63
63
|
outWidth: x,
|
|
64
64
|
outChannels: y,
|
|
65
|
-
padInfo:
|
|
65
|
+
padInfo: E,
|
|
66
66
|
strideHeight: A,
|
|
67
67
|
strideWidth: m,
|
|
68
68
|
filterHeight: l,
|
|
69
69
|
filterWidth: h,
|
|
70
70
|
effectiveFilterHeight: f,
|
|
71
|
-
effectiveFilterWidth:
|
|
71
|
+
effectiveFilterWidth: w,
|
|
72
72
|
dilationHeight: b,
|
|
73
73
|
dilationWidth: k,
|
|
74
74
|
inShape: e,
|
|
@@ -84,7 +84,7 @@ function he(e, t, n, s, r, u = !1, i = "channelsLast", o) {
|
|
|
84
84
|
[c, l, a, p, g] = e;
|
|
85
85
|
else
|
|
86
86
|
throw new Error(`Unknown dataFormat ${i}`);
|
|
87
|
-
const [h, d, A, , m] = t, [b, k, f] = W(n), [
|
|
87
|
+
const [h, d, A, , m] = t, [b, k, f] = W(n), [w, E, I] = W(s), x = G(h, w), y = G(d, E), $ = G(A, I), { padInfo: C, outDepth: M, outHeight: D, outWidth: F } = me(r, a, p, g, b, k, f, x, y, $, o), V = u ? m * l : m;
|
|
88
88
|
let U;
|
|
89
89
|
return i === "channelsFirst" ? U = [c, V, M, D, F] : i === "channelsLast" && (U = [c, M, D, F, V]), {
|
|
90
90
|
batchSize: c,
|
|
@@ -107,8 +107,8 @@ function he(e, t, n, s, r, u = !1, i = "channelsLast", o) {
|
|
|
107
107
|
effectiveFilterDepth: x,
|
|
108
108
|
effectiveFilterHeight: y,
|
|
109
109
|
effectiveFilterWidth: $,
|
|
110
|
-
dilationDepth:
|
|
111
|
-
dilationHeight:
|
|
110
|
+
dilationDepth: w,
|
|
111
|
+
dilationHeight: E,
|
|
112
112
|
dilationWidth: I,
|
|
113
113
|
inShape: e,
|
|
114
114
|
outShape: U,
|
|
@@ -116,18 +116,18 @@ function he(e, t, n, s, r, u = !1, i = "channelsLast", o) {
|
|
|
116
116
|
};
|
|
117
117
|
}
|
|
118
118
|
function ge(e, t, n, s, r) {
|
|
119
|
-
s == null && (s =
|
|
119
|
+
s == null && (s = X(e, t, n));
|
|
120
120
|
const u = e[0], i = e[1], o = R((u - t + 2 * s) / n + 1, r), c = R((i - t + 2 * s) / n + 1, r);
|
|
121
121
|
return [o, c];
|
|
122
122
|
}
|
|
123
123
|
function pe(e, t, n, s, r, u) {
|
|
124
|
-
r == null && (r =
|
|
124
|
+
r == null && (r = X(e, t[0], s[0]));
|
|
125
125
|
const i = [0, 0, 0, n];
|
|
126
126
|
for (let o = 0; o < 3; o++)
|
|
127
127
|
e[o] + 2 * r >= t[o] && (i[o] = R((e[o] - t[o] + 2 * r) / s[o] + 1, u));
|
|
128
128
|
return i;
|
|
129
129
|
}
|
|
130
|
-
function
|
|
130
|
+
function X(e, t, n, s = 1) {
|
|
131
131
|
const r = G(t, s);
|
|
132
132
|
return Math.floor((e[0] * (n - 1) - n + r) / 2);
|
|
133
133
|
}
|
|
@@ -175,8 +175,8 @@ function me(e, t, n, s, r, u, i, o, c, a, p) {
|
|
|
175
175
|
l = m[0], h = m[1], d = m[2];
|
|
176
176
|
} else if (e === "same") {
|
|
177
177
|
l = Math.ceil(t / r), h = Math.ceil(n / u), d = Math.ceil(s / i);
|
|
178
|
-
const A = (l - 1) * r + o - t, m = (h - 1) * u + c - n, b = (d - 1) * i + a - s, k = Math.floor(A / 2), f = A - k,
|
|
179
|
-
g = { top:
|
|
178
|
+
const A = (l - 1) * r + o - t, m = (h - 1) * u + c - n, b = (d - 1) * i + a - s, k = Math.floor(A / 2), f = A - k, w = Math.floor(m / 2), E = m - w, I = Math.floor(b / 2), x = b - I;
|
|
179
|
+
g = { top: w, bottom: E, left: I, right: x, front: k, back: f, type: "SAME" };
|
|
180
180
|
} else
|
|
181
181
|
throw Error(`Unknown padding parameter: ${e}`);
|
|
182
182
|
return { padInfo: g, outDepth: l, outHeight: h, outWidth: d };
|
|
@@ -244,11 +244,11 @@ function Qe(e, t, n) {
|
|
|
244
244
|
* limitations under the License.
|
|
245
245
|
* =============================================================================
|
|
246
246
|
*/
|
|
247
|
-
function
|
|
247
|
+
function we(e) {
|
|
248
248
|
const n = { x: S(e, "x", "sigmoid", "float32") };
|
|
249
249
|
return L.runKernel(te, n);
|
|
250
250
|
}
|
|
251
|
-
const
|
|
251
|
+
const Ee = /* @__PURE__ */ _({ sigmoid_: we });
|
|
252
252
|
/**
|
|
253
253
|
* @license
|
|
254
254
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
@@ -417,7 +417,7 @@ function ze(e, t, n, s) {
|
|
|
417
417
|
if (t === "leakyrelu")
|
|
418
418
|
return xe(e, s);
|
|
419
419
|
if (t === "sigmoid")
|
|
420
|
-
return
|
|
420
|
+
return Ee(e);
|
|
421
421
|
throw new Error(`Unknown fused activation ${t}.`);
|
|
422
422
|
}
|
|
423
423
|
const et = (e, t) => !(e > 0) || t === "linear";
|
|
@@ -600,43 +600,43 @@ function We(e, t, n, s, r, u, i, o, c) {
|
|
|
600
600
|
for (let f = 0; f < e.length; ++f) {
|
|
601
601
|
if (l.strides[f] === 0)
|
|
602
602
|
throw Error(`strides[${f}] must be non-zero`);
|
|
603
|
-
const
|
|
604
|
-
if (
|
|
605
|
-
m.push(
|
|
603
|
+
const w = !!(l.shrinkAxisMask & 1 << f), E = e[f];
|
|
604
|
+
if (E === -1) {
|
|
605
|
+
m.push(w ? 1 : -1);
|
|
606
606
|
continue;
|
|
607
607
|
}
|
|
608
608
|
const I = [l.beginMask & 1 << f, l.endMask & 1 << f], x = [
|
|
609
609
|
l.strides[f] > 0 ? 0 : -1,
|
|
610
|
-
l.strides[f] > 0 ?
|
|
610
|
+
l.strides[f] > 0 ? E : E - 1
|
|
611
611
|
];
|
|
612
|
-
if (
|
|
612
|
+
if (w && l.strides[f] <= 0)
|
|
613
613
|
throw Error("only stride 1 allowed on non-range indexing.");
|
|
614
614
|
A = A && l.strides[f] === 1;
|
|
615
615
|
const y = !!(l.beginMask & 1 << f && l.endMask & 1 << f);
|
|
616
616
|
if (l.beginValid && l.endValid) {
|
|
617
|
-
if (
|
|
618
|
-
const D = l.begin[f] < 0 ?
|
|
619
|
-
if (l.begin[f] = D, l.end[f] = l.begin[f] + 1, D < 0 || D >=
|
|
617
|
+
if (w) {
|
|
618
|
+
const D = l.begin[f] < 0 ? E + l.begin[f] : l.begin[f];
|
|
619
|
+
if (l.begin[f] = D, l.end[f] = l.begin[f] + 1, D < 0 || D >= E)
|
|
620
620
|
throw Error(`slice index ${l.begin[f]} of dimension ${f} out of bounds.`);
|
|
621
621
|
} else
|
|
622
|
-
l.begin[f] = K(l.begin[f], 0, l.strides[f],
|
|
623
|
-
const M = l.strides[f] === 1 && l.begin[f] === 0 && l.end[f] ===
|
|
622
|
+
l.begin[f] = K(l.begin[f], 0, l.strides[f], E, I, x), l.end[f] = K(l.end[f], 1, l.strides[f], E, I, x);
|
|
623
|
+
const M = l.strides[f] === 1 && l.begin[f] === 0 && l.end[f] === E;
|
|
624
624
|
h = h && M, d = d && (f === 0 && l.strides[f] === 1 || M);
|
|
625
625
|
} else
|
|
626
626
|
h = h && l.strides[f] === 1 && y, d = d && (f === 0 && l.strides[f] === 1 || y);
|
|
627
627
|
let $, C = !1;
|
|
628
|
-
if (l.beginValid && l.endValid ? ($ = l.end[f] - l.begin[f], C = !0) :
|
|
628
|
+
if (l.beginValid && l.endValid ? ($ = l.end[f] - l.begin[f], C = !0) : w ? ($ = 1, C = !0) : y && E >= 0 && (l.strides[f] < 0 ? $ = -E : $ = E, C = !0), C) {
|
|
629
629
|
let M;
|
|
630
630
|
$ === 0 || $ < 0 != l.strides[f] < 0 ? M = 0 : M = Math.trunc($ / l.strides[f]) + ($ % l.strides[f] !== 0 ? 1 : 0), m.push(M);
|
|
631
631
|
} else
|
|
632
632
|
m.push(-1);
|
|
633
633
|
}
|
|
634
634
|
for (let f = 0; f < l.finalShapeGatherIndices.length; ++f) {
|
|
635
|
-
const
|
|
636
|
-
|
|
635
|
+
const w = l.finalShapeGatherIndices[f];
|
|
636
|
+
w >= 0 ? b.push(m[w]) : w === v && b.push(1);
|
|
637
637
|
}
|
|
638
638
|
return {
|
|
639
|
-
finalShapeSparse: b.filter((f,
|
|
639
|
+
finalShapeSparse: b.filter((f, w) => l.finalShapeGatherIndices[w] !== v),
|
|
640
640
|
finalShape: b,
|
|
641
641
|
isIdentity: h,
|
|
642
642
|
sliceDim0: d,
|
|
@@ -707,18 +707,18 @@ const tt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
707
707
|
const nt = 1.7580993408473768, st = 1.0507009873554805;
|
|
708
708
|
export {
|
|
709
709
|
Me as A,
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
710
|
+
We as B,
|
|
711
|
+
Re as C,
|
|
712
|
+
Ne as D,
|
|
713
713
|
st as S,
|
|
714
714
|
nt as a,
|
|
715
715
|
ze as b,
|
|
716
716
|
Qe as c,
|
|
717
|
-
|
|
717
|
+
B as d,
|
|
718
718
|
he as e,
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
719
|
+
X as f,
|
|
720
|
+
Be as g,
|
|
721
|
+
Xe as h,
|
|
722
722
|
je as i,
|
|
723
723
|
Ae as j,
|
|
724
724
|
qe as k,
|
|
@@ -733,7 +733,7 @@ export {
|
|
|
733
733
|
P as t,
|
|
734
734
|
Ve as u,
|
|
735
735
|
Le as v,
|
|
736
|
-
|
|
736
|
+
Ee as w,
|
|
737
737
|
$e as x,
|
|
738
738
|
Se as y,
|
|
739
739
|
xe as z
|