@genai-fi/nanogpt 0.5.6 → 0.6.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 +10 -9
- package/dist/NanoGPTModel.js +70 -121
- package/dist/RealDiv-7xu-pkZN.js +540 -0
- package/dist/Reshape-BYC1oUku.js +127 -0
- package/dist/TeachableLLM.d.ts +2 -0
- package/dist/TeachableLLM.js +42 -34
- package/dist/{TiedEmbedding-8S8xn8e6.js → TiedEmbedding-C1HBot-5.js} +12 -13
- package/dist/{axis_util-BczFISHz.js → axis_util-CCNL7jea.js} +14 -12
- package/dist/{broadcast_to-B7NGsBSh.js → broadcast_to-CddAF879.js} +2 -2
- package/dist/{concat-DdKPyAtw.js → concat-XOK9ANZu.js} +7 -7
- package/dist/{dataset-iqT4Otvb.js → dataset-BFFipD1c.js} +5 -5
- package/dist/{dropout-B09InSJS.js → dropout-xlKRoJyU.js} +9 -9
- package/dist/{gather-D6MsdXqc.js → gather-DKtUaTtA.js} +1 -1
- package/dist/gpgpu_math-B_ycgZ4W.js +3115 -0
- package/dist/{index-Du-bmOP8.js → index-CamYe_M8.js} +844 -647
- package/dist/{kernel_funcs_utils-DShm7-0k.js → kernel_funcs_utils-D5MS0JFg.js} +232 -136
- package/dist/layers/BaseLayer.js +2 -2
- package/dist/layers/CausalSelfAttention.js +6 -6
- package/dist/layers/MLP.js +5 -5
- package/dist/layers/RMSNorm.js +3 -3
- package/dist/layers/RoPECache.js +13 -33
- package/dist/layers/TiedEmbedding.js +6 -7
- package/dist/layers/TransformerBlock.js +1 -1
- package/dist/{log_sum_exp-CxfBtUaG.js → log_sum_exp-CV_5-TTu.js} +15 -15
- package/dist/main.js +24 -20
- package/dist/{mat_mul-CbiqIe2d.js → mat_mul-CAbRFWUj.js} +4 -4
- package/dist/{max-0Xnlpv8k.js → max-JBBv7aUf.js} +3 -3
- package/dist/mulmat_packed_gpu-DW4doKL_.js +71 -0
- package/dist/{norm-01kY9I2B.js → norm-B9dQTFYn.js} +12 -12
- package/dist/{ones-CrutWGas.js → ones-CMHNqMr6.js} +2 -2
- package/dist/ops/appendCache.js +3 -3
- package/dist/ops/attentionMask.js +1 -1
- package/dist/ops/cpu/appendCache.js +2 -2
- package/dist/ops/cpu/attentionMask.js +5 -5
- package/dist/ops/cpu/fusedSoftmax.js +2 -2
- package/dist/ops/cpu/gatherSub.js +5 -5
- package/dist/ops/cpu/gelu.js +1 -1
- package/dist/ops/cpu/matMulGelu.js +1 -1
- package/dist/ops/cpu/matMulMul.js +1 -1
- package/dist/ops/cpu/mulDropout.js +1 -1
- package/dist/ops/cpu/normRMS.js +1 -1
- package/dist/ops/cpu/qkv.js +3 -3
- package/dist/ops/cpu/rope.js +5 -5
- package/dist/ops/cpu/scatterSub.js +18 -49
- package/dist/ops/fusedSoftmax.js +1 -1
- package/dist/ops/gatherSub.js +1 -1
- package/dist/ops/gelu.js +1 -1
- package/dist/ops/grads/attentionMask.js +15 -11
- package/dist/ops/grads/fusedSoftmax.js +12 -10
- package/dist/ops/grads/gelu.js +1 -1
- package/dist/ops/grads/matMulGelu.js +1 -1
- package/dist/ops/grads/normRMS.js +1 -1
- package/dist/ops/grads/qkv.js +1 -1
- package/dist/ops/grads/rope.js +1 -1
- package/dist/ops/log.d.ts +0 -0
- package/dist/ops/log.js +1 -0
- package/dist/ops/matMulGelu.js +1 -1
- package/dist/ops/matMulMul.js +1 -1
- package/dist/ops/mulDrop.js +1 -1
- package/dist/ops/node/sparseCrossEntropy.js +1 -1
- package/dist/ops/normRMS.js +1 -1
- package/dist/ops/qkv.js +1 -1
- package/dist/ops/rope.js +8 -4
- package/dist/ops/scatterSub.js +1 -1
- package/dist/ops/webgl/appendCache.js +1 -1
- package/dist/ops/webgl/attentionMask.js +1 -1
- package/dist/ops/webgl/fusedSoftmax.js +31 -3379
- package/dist/ops/webgl/gatherSub.js +1 -1
- package/dist/ops/webgl/gelu.js +2 -2
- package/dist/{gpgpu_math-BFbOyvk4.js → ops/webgl/log.d.ts} +2 -8
- package/dist/ops/webgl/log.js +39 -0
- package/dist/ops/webgl/matMulGelu.js +48 -115
- package/dist/ops/webgl/matMulMul.js +1 -1
- package/dist/ops/webgl/mulDropout.js +1 -1
- 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-CJNniCAV.js → ops-DqtYemmV.js} +143 -135
- package/dist/{random_width-C-v-35bY.js → random_width-CLMQG5Jn.js} +6925 -6291
- package/dist/{range-Bvs1hidm.js → range-DqYjKnuG.js} +1 -1
- package/dist/reciprocal-z49filta.js +25 -0
- package/dist/register_all_kernels-COt6wLD0.js +21397 -0
- package/dist/{reshape-BH7eBpwq.js → reshape-C45vIIRU.js} +1 -1
- package/dist/scatter_nd_util-qgtnviTE.js +46 -0
- package/dist/selu_util-4QV_GXTB.js +740 -0
- package/dist/shared-ByfrGA97.js +3199 -0
- package/dist/{sin-CPAZXNjH.js → sin-9JBrfVaB.js} +1 -1
- package/dist/{softmax-DhWoBa7r.js → softmax-DvMvui-_.js} +1 -1
- package/dist/{split-BCUhuU7B.js → split-DxrHrPFK.js} +4 -4
- package/dist/{stack-BV1v7l3S.js → stack-DgaoDmnF.js} +1 -1
- package/dist/{sum-Cvq06317.js → sum-BpcpxNEh.js} +3 -3
- package/dist/{tensor-DgTOPY6h.js → tensor-CDz5x1mP.js} +1 -1
- package/dist/{tensor2d-CRWjDyUe.js → tensor2d-jO8JY5Jd.js} +1 -1
- package/dist/training/AdamExt.js +1 -1
- package/dist/training/DatasetBuilder.js +2 -2
- package/dist/training/FullTrainer.js +1 -1
- package/dist/training/Trainer.js +3 -3
- package/dist/training/sparseCrossEntropy.js +4 -4
- package/dist/utilities/dummy.d.ts +6 -0
- package/dist/utilities/dummy.js +31 -10
- package/dist/utilities/generate.js +3 -3
- package/dist/utilities/load.d.ts +25 -0
- package/dist/utilities/load.js +89 -37
- package/dist/utilities/profile.d.ts +5 -0
- package/dist/utilities/profile.js +12 -9
- package/dist/utilities/safetensors.d.ts +3 -0
- package/dist/utilities/safetensors.js +83 -0
- package/dist/utilities/save.js +47 -29
- package/dist/utilities/weights.js +2 -2
- package/dist/{variable-DZ3fF0R2.js → variable-CLVXjN7F.js} +1 -1
- package/dist/{zeros-BaHhQTWf.js → zeros-DUkkVccu.js} +8 -8
- package/package.json +3 -9
- package/dist/Reshape-Biok_3X1.js +0 -212
- package/dist/slice_util-DskXqRZa.js +0 -49
- package/dist/tfjs_backend-D9Ytje0G.js +0 -1010
|
@@ -0,0 +1,3199 @@
|
|
|
1
|
+
import { k as qt, bc as _e, i as A, j as Ut, W as K, bd as et, aH as ht, be as gt, bf as at, _ as Ve, $ as st, ak as De, a$ as We, bg as $e, bh as ze, bi as Be, bj as Mt, ah as H, bk as Ot, bl as D, bm as Lt, bn as At, a8 as _t, bo as Vt, ag as Dt, bp as Wt, aT as $t, aU as zt, aW as Bt, aX as Gt, a9 as jt, bq as Zt, a_ as Ht, br as Kt, aY as Ge, am as je, bs as Xt, b2 as Ze, bt as He, p as Yt, u as Ke, t as Xe, bu as Jt, bv as wt, ap as Qt, aO as Ye, bw as te, bx as ee, by as ne, aG as pt, bz as se, bA as ot } from "./index-CamYe_M8.js";
|
|
2
|
+
import { h as it, m as kt, k as Je, l as Qe, R as tn, v as en, n as nn, o as sn, p as on, q as rn, r as an, s as ln, t as cn, w as un, x as hn, y as fn, z as Nt, A as gn, B as dn, C as mn } from "./gpgpu_math-B_ycgZ4W.js";
|
|
3
|
+
import { g as pn, a as In, e as wn, c as bn } from "./axis_util-CCNL7jea.js";
|
|
4
|
+
import { b as xn } from "./broadcast_to-CddAF879.js";
|
|
5
|
+
import { r as En } from "./reshape-C45vIIRU.js";
|
|
6
|
+
import { p as Fn, q as yn, r as kn, u as Nn } from "./selu_util-4QV_GXTB.js";
|
|
7
|
+
import { g as Sn } from "./_commonjsHelpers-ByX85dGu.js";
|
|
8
|
+
function vn(e, t) {
|
|
9
|
+
for (var n = 0; n < t.length; n++) {
|
|
10
|
+
const s = t[n];
|
|
11
|
+
if (typeof s != "string" && !Array.isArray(s)) {
|
|
12
|
+
for (const o in s)
|
|
13
|
+
if (o !== "default" && !(o in e)) {
|
|
14
|
+
const a = Object.getOwnPropertyDescriptor(s, o);
|
|
15
|
+
a && Object.defineProperty(e, o, a.get ? a : {
|
|
16
|
+
enumerable: !0,
|
|
17
|
+
get: () => s[o]
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return Object.freeze(Object.defineProperty(e, Symbol.toStringTag, { value: "Module" }));
|
|
23
|
+
}
|
|
24
|
+
var It, St;
|
|
25
|
+
function Tn() {
|
|
26
|
+
if (St) return It;
|
|
27
|
+
St = 1, It = t;
|
|
28
|
+
var e = null;
|
|
29
|
+
try {
|
|
30
|
+
e = new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([
|
|
31
|
+
0,
|
|
32
|
+
97,
|
|
33
|
+
115,
|
|
34
|
+
109,
|
|
35
|
+
1,
|
|
36
|
+
0,
|
|
37
|
+
0,
|
|
38
|
+
0,
|
|
39
|
+
1,
|
|
40
|
+
13,
|
|
41
|
+
2,
|
|
42
|
+
96,
|
|
43
|
+
0,
|
|
44
|
+
1,
|
|
45
|
+
127,
|
|
46
|
+
96,
|
|
47
|
+
4,
|
|
48
|
+
127,
|
|
49
|
+
127,
|
|
50
|
+
127,
|
|
51
|
+
127,
|
|
52
|
+
1,
|
|
53
|
+
127,
|
|
54
|
+
3,
|
|
55
|
+
7,
|
|
56
|
+
6,
|
|
57
|
+
0,
|
|
58
|
+
1,
|
|
59
|
+
1,
|
|
60
|
+
1,
|
|
61
|
+
1,
|
|
62
|
+
1,
|
|
63
|
+
6,
|
|
64
|
+
6,
|
|
65
|
+
1,
|
|
66
|
+
127,
|
|
67
|
+
1,
|
|
68
|
+
65,
|
|
69
|
+
0,
|
|
70
|
+
11,
|
|
71
|
+
7,
|
|
72
|
+
50,
|
|
73
|
+
6,
|
|
74
|
+
3,
|
|
75
|
+
109,
|
|
76
|
+
117,
|
|
77
|
+
108,
|
|
78
|
+
0,
|
|
79
|
+
1,
|
|
80
|
+
5,
|
|
81
|
+
100,
|
|
82
|
+
105,
|
|
83
|
+
118,
|
|
84
|
+
95,
|
|
85
|
+
115,
|
|
86
|
+
0,
|
|
87
|
+
2,
|
|
88
|
+
5,
|
|
89
|
+
100,
|
|
90
|
+
105,
|
|
91
|
+
118,
|
|
92
|
+
95,
|
|
93
|
+
117,
|
|
94
|
+
0,
|
|
95
|
+
3,
|
|
96
|
+
5,
|
|
97
|
+
114,
|
|
98
|
+
101,
|
|
99
|
+
109,
|
|
100
|
+
95,
|
|
101
|
+
115,
|
|
102
|
+
0,
|
|
103
|
+
4,
|
|
104
|
+
5,
|
|
105
|
+
114,
|
|
106
|
+
101,
|
|
107
|
+
109,
|
|
108
|
+
95,
|
|
109
|
+
117,
|
|
110
|
+
0,
|
|
111
|
+
5,
|
|
112
|
+
8,
|
|
113
|
+
103,
|
|
114
|
+
101,
|
|
115
|
+
116,
|
|
116
|
+
95,
|
|
117
|
+
104,
|
|
118
|
+
105,
|
|
119
|
+
103,
|
|
120
|
+
104,
|
|
121
|
+
0,
|
|
122
|
+
0,
|
|
123
|
+
10,
|
|
124
|
+
191,
|
|
125
|
+
1,
|
|
126
|
+
6,
|
|
127
|
+
4,
|
|
128
|
+
0,
|
|
129
|
+
35,
|
|
130
|
+
0,
|
|
131
|
+
11,
|
|
132
|
+
36,
|
|
133
|
+
1,
|
|
134
|
+
1,
|
|
135
|
+
126,
|
|
136
|
+
32,
|
|
137
|
+
0,
|
|
138
|
+
173,
|
|
139
|
+
32,
|
|
140
|
+
1,
|
|
141
|
+
173,
|
|
142
|
+
66,
|
|
143
|
+
32,
|
|
144
|
+
134,
|
|
145
|
+
132,
|
|
146
|
+
32,
|
|
147
|
+
2,
|
|
148
|
+
173,
|
|
149
|
+
32,
|
|
150
|
+
3,
|
|
151
|
+
173,
|
|
152
|
+
66,
|
|
153
|
+
32,
|
|
154
|
+
134,
|
|
155
|
+
132,
|
|
156
|
+
126,
|
|
157
|
+
34,
|
|
158
|
+
4,
|
|
159
|
+
66,
|
|
160
|
+
32,
|
|
161
|
+
135,
|
|
162
|
+
167,
|
|
163
|
+
36,
|
|
164
|
+
0,
|
|
165
|
+
32,
|
|
166
|
+
4,
|
|
167
|
+
167,
|
|
168
|
+
11,
|
|
169
|
+
36,
|
|
170
|
+
1,
|
|
171
|
+
1,
|
|
172
|
+
126,
|
|
173
|
+
32,
|
|
174
|
+
0,
|
|
175
|
+
173,
|
|
176
|
+
32,
|
|
177
|
+
1,
|
|
178
|
+
173,
|
|
179
|
+
66,
|
|
180
|
+
32,
|
|
181
|
+
134,
|
|
182
|
+
132,
|
|
183
|
+
32,
|
|
184
|
+
2,
|
|
185
|
+
173,
|
|
186
|
+
32,
|
|
187
|
+
3,
|
|
188
|
+
173,
|
|
189
|
+
66,
|
|
190
|
+
32,
|
|
191
|
+
134,
|
|
192
|
+
132,
|
|
193
|
+
127,
|
|
194
|
+
34,
|
|
195
|
+
4,
|
|
196
|
+
66,
|
|
197
|
+
32,
|
|
198
|
+
135,
|
|
199
|
+
167,
|
|
200
|
+
36,
|
|
201
|
+
0,
|
|
202
|
+
32,
|
|
203
|
+
4,
|
|
204
|
+
167,
|
|
205
|
+
11,
|
|
206
|
+
36,
|
|
207
|
+
1,
|
|
208
|
+
1,
|
|
209
|
+
126,
|
|
210
|
+
32,
|
|
211
|
+
0,
|
|
212
|
+
173,
|
|
213
|
+
32,
|
|
214
|
+
1,
|
|
215
|
+
173,
|
|
216
|
+
66,
|
|
217
|
+
32,
|
|
218
|
+
134,
|
|
219
|
+
132,
|
|
220
|
+
32,
|
|
221
|
+
2,
|
|
222
|
+
173,
|
|
223
|
+
32,
|
|
224
|
+
3,
|
|
225
|
+
173,
|
|
226
|
+
66,
|
|
227
|
+
32,
|
|
228
|
+
134,
|
|
229
|
+
132,
|
|
230
|
+
128,
|
|
231
|
+
34,
|
|
232
|
+
4,
|
|
233
|
+
66,
|
|
234
|
+
32,
|
|
235
|
+
135,
|
|
236
|
+
167,
|
|
237
|
+
36,
|
|
238
|
+
0,
|
|
239
|
+
32,
|
|
240
|
+
4,
|
|
241
|
+
167,
|
|
242
|
+
11,
|
|
243
|
+
36,
|
|
244
|
+
1,
|
|
245
|
+
1,
|
|
246
|
+
126,
|
|
247
|
+
32,
|
|
248
|
+
0,
|
|
249
|
+
173,
|
|
250
|
+
32,
|
|
251
|
+
1,
|
|
252
|
+
173,
|
|
253
|
+
66,
|
|
254
|
+
32,
|
|
255
|
+
134,
|
|
256
|
+
132,
|
|
257
|
+
32,
|
|
258
|
+
2,
|
|
259
|
+
173,
|
|
260
|
+
32,
|
|
261
|
+
3,
|
|
262
|
+
173,
|
|
263
|
+
66,
|
|
264
|
+
32,
|
|
265
|
+
134,
|
|
266
|
+
132,
|
|
267
|
+
129,
|
|
268
|
+
34,
|
|
269
|
+
4,
|
|
270
|
+
66,
|
|
271
|
+
32,
|
|
272
|
+
135,
|
|
273
|
+
167,
|
|
274
|
+
36,
|
|
275
|
+
0,
|
|
276
|
+
32,
|
|
277
|
+
4,
|
|
278
|
+
167,
|
|
279
|
+
11,
|
|
280
|
+
36,
|
|
281
|
+
1,
|
|
282
|
+
1,
|
|
283
|
+
126,
|
|
284
|
+
32,
|
|
285
|
+
0,
|
|
286
|
+
173,
|
|
287
|
+
32,
|
|
288
|
+
1,
|
|
289
|
+
173,
|
|
290
|
+
66,
|
|
291
|
+
32,
|
|
292
|
+
134,
|
|
293
|
+
132,
|
|
294
|
+
32,
|
|
295
|
+
2,
|
|
296
|
+
173,
|
|
297
|
+
32,
|
|
298
|
+
3,
|
|
299
|
+
173,
|
|
300
|
+
66,
|
|
301
|
+
32,
|
|
302
|
+
134,
|
|
303
|
+
132,
|
|
304
|
+
130,
|
|
305
|
+
34,
|
|
306
|
+
4,
|
|
307
|
+
66,
|
|
308
|
+
32,
|
|
309
|
+
135,
|
|
310
|
+
167,
|
|
311
|
+
36,
|
|
312
|
+
0,
|
|
313
|
+
32,
|
|
314
|
+
4,
|
|
315
|
+
167,
|
|
316
|
+
11
|
|
317
|
+
])), {}).exports;
|
|
318
|
+
} catch {
|
|
319
|
+
}
|
|
320
|
+
function t(w, c, E) {
|
|
321
|
+
this.low = w | 0, this.high = c | 0, this.unsigned = !!E;
|
|
322
|
+
}
|
|
323
|
+
t.prototype.__isLong__, Object.defineProperty(t.prototype, "__isLong__", { value: !0 });
|
|
324
|
+
function n(w) {
|
|
325
|
+
return (w && w.__isLong__) === !0;
|
|
326
|
+
}
|
|
327
|
+
t.isLong = n;
|
|
328
|
+
var s = {}, o = {};
|
|
329
|
+
function a(w, c) {
|
|
330
|
+
var E, N, q;
|
|
331
|
+
return c ? (w >>>= 0, (q = 0 <= w && w < 256) && (N = o[w], N) ? N : (E = i(w, (w | 0) < 0 ? -1 : 0, !0), q && (o[w] = E), E)) : (w |= 0, (q = -128 <= w && w < 128) && (N = s[w], N) ? N : (E = i(w, w < 0 ? -1 : 0, !1), q && (s[w] = E), E));
|
|
332
|
+
}
|
|
333
|
+
t.fromInt = a;
|
|
334
|
+
function r(w, c) {
|
|
335
|
+
if (isNaN(w))
|
|
336
|
+
return c ? b : d;
|
|
337
|
+
if (c) {
|
|
338
|
+
if (w < 0)
|
|
339
|
+
return b;
|
|
340
|
+
if (w >= m)
|
|
341
|
+
return C;
|
|
342
|
+
} else {
|
|
343
|
+
if (w <= -F)
|
|
344
|
+
return v;
|
|
345
|
+
if (w + 1 >= F)
|
|
346
|
+
return P;
|
|
347
|
+
}
|
|
348
|
+
return w < 0 ? r(-w, c).neg() : i(w % I | 0, w / I | 0, c);
|
|
349
|
+
}
|
|
350
|
+
t.fromNumber = r;
|
|
351
|
+
function i(w, c, E) {
|
|
352
|
+
return new t(w, c, E);
|
|
353
|
+
}
|
|
354
|
+
t.fromBits = i;
|
|
355
|
+
var l = Math.pow;
|
|
356
|
+
function u(w, c, E) {
|
|
357
|
+
if (w.length === 0)
|
|
358
|
+
throw Error("empty string");
|
|
359
|
+
if (w === "NaN" || w === "Infinity" || w === "+Infinity" || w === "-Infinity")
|
|
360
|
+
return d;
|
|
361
|
+
if (typeof c == "number" ? (E = c, c = !1) : c = !!c, E = E || 10, E < 2 || 36 < E)
|
|
362
|
+
throw RangeError("radix");
|
|
363
|
+
var N;
|
|
364
|
+
if ((N = w.indexOf("-")) > 0)
|
|
365
|
+
throw Error("interior hyphen");
|
|
366
|
+
if (N === 0)
|
|
367
|
+
return u(w.substring(1), c, E).neg();
|
|
368
|
+
for (var q = r(l(E, 8)), R = d, M = 0; M < w.length; M += 8) {
|
|
369
|
+
var $ = Math.min(8, w.length - M), G = parseInt(w.substring(M, M + $), E);
|
|
370
|
+
if ($ < 8) {
|
|
371
|
+
var _ = r(l(E, $));
|
|
372
|
+
R = R.mul(_).add(r(G));
|
|
373
|
+
} else
|
|
374
|
+
R = R.mul(q), R = R.add(r(G));
|
|
375
|
+
}
|
|
376
|
+
return R.unsigned = c, R;
|
|
377
|
+
}
|
|
378
|
+
t.fromString = u;
|
|
379
|
+
function h(w, c) {
|
|
380
|
+
return typeof w == "number" ? r(w, c) : typeof w == "string" ? u(w, c) : i(w.low, w.high, typeof c == "boolean" ? c : w.unsigned);
|
|
381
|
+
}
|
|
382
|
+
t.fromValue = h;
|
|
383
|
+
var f = 65536, p = 1 << 24, I = f * f, m = I * I, F = m / 2, g = a(p), d = a(0);
|
|
384
|
+
t.ZERO = d;
|
|
385
|
+
var b = a(0, !0);
|
|
386
|
+
t.UZERO = b;
|
|
387
|
+
var k = a(1);
|
|
388
|
+
t.ONE = k;
|
|
389
|
+
var y = a(1, !0);
|
|
390
|
+
t.UONE = y;
|
|
391
|
+
var S = a(-1);
|
|
392
|
+
t.NEG_ONE = S;
|
|
393
|
+
var P = i(-1, 2147483647, !1);
|
|
394
|
+
t.MAX_VALUE = P;
|
|
395
|
+
var C = i(-1, -1, !0);
|
|
396
|
+
t.MAX_UNSIGNED_VALUE = C;
|
|
397
|
+
var v = i(0, -2147483648, !1);
|
|
398
|
+
t.MIN_VALUE = v;
|
|
399
|
+
var x = t.prototype;
|
|
400
|
+
return x.toInt = function() {
|
|
401
|
+
return this.unsigned ? this.low >>> 0 : this.low;
|
|
402
|
+
}, x.toNumber = function() {
|
|
403
|
+
return this.unsigned ? (this.high >>> 0) * I + (this.low >>> 0) : this.high * I + (this.low >>> 0);
|
|
404
|
+
}, x.toString = function(c) {
|
|
405
|
+
if (c = c || 10, c < 2 || 36 < c)
|
|
406
|
+
throw RangeError("radix");
|
|
407
|
+
if (this.isZero())
|
|
408
|
+
return "0";
|
|
409
|
+
if (this.isNegative())
|
|
410
|
+
if (this.eq(v)) {
|
|
411
|
+
var E = r(c), N = this.div(E), q = N.mul(E).sub(this);
|
|
412
|
+
return N.toString(c) + q.toInt().toString(c);
|
|
413
|
+
} else
|
|
414
|
+
return "-" + this.neg().toString(c);
|
|
415
|
+
for (var R = r(l(c, 6), this.unsigned), M = this, $ = ""; ; ) {
|
|
416
|
+
var G = M.div(R), _ = M.sub(G.mul(R)).toInt() >>> 0, U = _.toString(c);
|
|
417
|
+
if (M = G, M.isZero())
|
|
418
|
+
return U + $;
|
|
419
|
+
for (; U.length < 6; )
|
|
420
|
+
U = "0" + U;
|
|
421
|
+
$ = "" + U + $;
|
|
422
|
+
}
|
|
423
|
+
}, x.getHighBits = function() {
|
|
424
|
+
return this.high;
|
|
425
|
+
}, x.getHighBitsUnsigned = function() {
|
|
426
|
+
return this.high >>> 0;
|
|
427
|
+
}, x.getLowBits = function() {
|
|
428
|
+
return this.low;
|
|
429
|
+
}, x.getLowBitsUnsigned = function() {
|
|
430
|
+
return this.low >>> 0;
|
|
431
|
+
}, x.getNumBitsAbs = function() {
|
|
432
|
+
if (this.isNegative())
|
|
433
|
+
return this.eq(v) ? 64 : this.neg().getNumBitsAbs();
|
|
434
|
+
for (var c = this.high != 0 ? this.high : this.low, E = 31; E > 0 && (c & 1 << E) == 0; E--)
|
|
435
|
+
;
|
|
436
|
+
return this.high != 0 ? E + 33 : E + 1;
|
|
437
|
+
}, x.isZero = function() {
|
|
438
|
+
return this.high === 0 && this.low === 0;
|
|
439
|
+
}, x.eqz = x.isZero, x.isNegative = function() {
|
|
440
|
+
return !this.unsigned && this.high < 0;
|
|
441
|
+
}, x.isPositive = function() {
|
|
442
|
+
return this.unsigned || this.high >= 0;
|
|
443
|
+
}, x.isOdd = function() {
|
|
444
|
+
return (this.low & 1) === 1;
|
|
445
|
+
}, x.isEven = function() {
|
|
446
|
+
return (this.low & 1) === 0;
|
|
447
|
+
}, x.equals = function(c) {
|
|
448
|
+
return n(c) || (c = h(c)), this.unsigned !== c.unsigned && this.high >>> 31 === 1 && c.high >>> 31 === 1 ? !1 : this.high === c.high && this.low === c.low;
|
|
449
|
+
}, x.eq = x.equals, x.notEquals = function(c) {
|
|
450
|
+
return !this.eq(
|
|
451
|
+
/* validates */
|
|
452
|
+
c
|
|
453
|
+
);
|
|
454
|
+
}, x.neq = x.notEquals, x.ne = x.notEquals, x.lessThan = function(c) {
|
|
455
|
+
return this.comp(
|
|
456
|
+
/* validates */
|
|
457
|
+
c
|
|
458
|
+
) < 0;
|
|
459
|
+
}, x.lt = x.lessThan, x.lessThanOrEqual = function(c) {
|
|
460
|
+
return this.comp(
|
|
461
|
+
/* validates */
|
|
462
|
+
c
|
|
463
|
+
) <= 0;
|
|
464
|
+
}, x.lte = x.lessThanOrEqual, x.le = x.lessThanOrEqual, x.greaterThan = function(c) {
|
|
465
|
+
return this.comp(
|
|
466
|
+
/* validates */
|
|
467
|
+
c
|
|
468
|
+
) > 0;
|
|
469
|
+
}, x.gt = x.greaterThan, x.greaterThanOrEqual = function(c) {
|
|
470
|
+
return this.comp(
|
|
471
|
+
/* validates */
|
|
472
|
+
c
|
|
473
|
+
) >= 0;
|
|
474
|
+
}, x.gte = x.greaterThanOrEqual, x.ge = x.greaterThanOrEqual, x.compare = function(c) {
|
|
475
|
+
if (n(c) || (c = h(c)), this.eq(c))
|
|
476
|
+
return 0;
|
|
477
|
+
var E = this.isNegative(), N = c.isNegative();
|
|
478
|
+
return E && !N ? -1 : !E && N ? 1 : this.unsigned ? c.high >>> 0 > this.high >>> 0 || c.high === this.high && c.low >>> 0 > this.low >>> 0 ? -1 : 1 : this.sub(c).isNegative() ? -1 : 1;
|
|
479
|
+
}, x.comp = x.compare, x.negate = function() {
|
|
480
|
+
return !this.unsigned && this.eq(v) ? v : this.not().add(k);
|
|
481
|
+
}, x.neg = x.negate, x.add = function(c) {
|
|
482
|
+
n(c) || (c = h(c));
|
|
483
|
+
var E = this.high >>> 16, N = this.high & 65535, q = this.low >>> 16, R = this.low & 65535, M = c.high >>> 16, $ = c.high & 65535, G = c.low >>> 16, _ = c.low & 65535, U = 0, j = 0, L = 0, B = 0;
|
|
484
|
+
return B += R + _, L += B >>> 16, B &= 65535, L += q + G, j += L >>> 16, L &= 65535, j += N + $, U += j >>> 16, j &= 65535, U += E + M, U &= 65535, i(L << 16 | B, U << 16 | j, this.unsigned);
|
|
485
|
+
}, x.subtract = function(c) {
|
|
486
|
+
return n(c) || (c = h(c)), this.add(c.neg());
|
|
487
|
+
}, x.sub = x.subtract, x.multiply = function(c) {
|
|
488
|
+
if (this.isZero())
|
|
489
|
+
return d;
|
|
490
|
+
if (n(c) || (c = h(c)), e) {
|
|
491
|
+
var E = e.mul(
|
|
492
|
+
this.low,
|
|
493
|
+
this.high,
|
|
494
|
+
c.low,
|
|
495
|
+
c.high
|
|
496
|
+
);
|
|
497
|
+
return i(E, e.get_high(), this.unsigned);
|
|
498
|
+
}
|
|
499
|
+
if (c.isZero())
|
|
500
|
+
return d;
|
|
501
|
+
if (this.eq(v))
|
|
502
|
+
return c.isOdd() ? v : d;
|
|
503
|
+
if (c.eq(v))
|
|
504
|
+
return this.isOdd() ? v : d;
|
|
505
|
+
if (this.isNegative())
|
|
506
|
+
return c.isNegative() ? this.neg().mul(c.neg()) : this.neg().mul(c).neg();
|
|
507
|
+
if (c.isNegative())
|
|
508
|
+
return this.mul(c.neg()).neg();
|
|
509
|
+
if (this.lt(g) && c.lt(g))
|
|
510
|
+
return r(this.toNumber() * c.toNumber(), this.unsigned);
|
|
511
|
+
var N = this.high >>> 16, q = this.high & 65535, R = this.low >>> 16, M = this.low & 65535, $ = c.high >>> 16, G = c.high & 65535, _ = c.low >>> 16, U = c.low & 65535, j = 0, L = 0, B = 0, ct = 0;
|
|
512
|
+
return ct += M * U, B += ct >>> 16, ct &= 65535, B += R * U, L += B >>> 16, B &= 65535, B += M * _, L += B >>> 16, B &= 65535, L += q * U, j += L >>> 16, L &= 65535, L += R * _, j += L >>> 16, L &= 65535, L += M * G, j += L >>> 16, L &= 65535, j += N * U + q * _ + R * G + M * $, j &= 65535, i(B << 16 | ct, j << 16 | L, this.unsigned);
|
|
513
|
+
}, x.mul = x.multiply, x.divide = function(c) {
|
|
514
|
+
if (n(c) || (c = h(c)), c.isZero())
|
|
515
|
+
throw Error("division by zero");
|
|
516
|
+
if (e) {
|
|
517
|
+
if (!this.unsigned && this.high === -2147483648 && c.low === -1 && c.high === -1)
|
|
518
|
+
return this;
|
|
519
|
+
var E = (this.unsigned ? e.div_u : e.div_s)(
|
|
520
|
+
this.low,
|
|
521
|
+
this.high,
|
|
522
|
+
c.low,
|
|
523
|
+
c.high
|
|
524
|
+
);
|
|
525
|
+
return i(E, e.get_high(), this.unsigned);
|
|
526
|
+
}
|
|
527
|
+
if (this.isZero())
|
|
528
|
+
return this.unsigned ? b : d;
|
|
529
|
+
var N, q, R;
|
|
530
|
+
if (this.unsigned) {
|
|
531
|
+
if (c.unsigned || (c = c.toUnsigned()), c.gt(this))
|
|
532
|
+
return b;
|
|
533
|
+
if (c.gt(this.shru(1)))
|
|
534
|
+
return y;
|
|
535
|
+
R = b;
|
|
536
|
+
} else {
|
|
537
|
+
if (this.eq(v)) {
|
|
538
|
+
if (c.eq(k) || c.eq(S))
|
|
539
|
+
return v;
|
|
540
|
+
if (c.eq(v))
|
|
541
|
+
return k;
|
|
542
|
+
var M = this.shr(1);
|
|
543
|
+
return N = M.div(c).shl(1), N.eq(d) ? c.isNegative() ? k : S : (q = this.sub(c.mul(N)), R = N.add(q.div(c)), R);
|
|
544
|
+
} else if (c.eq(v))
|
|
545
|
+
return this.unsigned ? b : d;
|
|
546
|
+
if (this.isNegative())
|
|
547
|
+
return c.isNegative() ? this.neg().div(c.neg()) : this.neg().div(c).neg();
|
|
548
|
+
if (c.isNegative())
|
|
549
|
+
return this.div(c.neg()).neg();
|
|
550
|
+
R = d;
|
|
551
|
+
}
|
|
552
|
+
for (q = this; q.gte(c); ) {
|
|
553
|
+
N = Math.max(1, Math.floor(q.toNumber() / c.toNumber()));
|
|
554
|
+
for (var $ = Math.ceil(Math.log(N) / Math.LN2), G = $ <= 48 ? 1 : l(2, $ - 48), _ = r(N), U = _.mul(c); U.isNegative() || U.gt(q); )
|
|
555
|
+
N -= G, _ = r(N, this.unsigned), U = _.mul(c);
|
|
556
|
+
_.isZero() && (_ = k), R = R.add(_), q = q.sub(U);
|
|
557
|
+
}
|
|
558
|
+
return R;
|
|
559
|
+
}, x.div = x.divide, x.modulo = function(c) {
|
|
560
|
+
if (n(c) || (c = h(c)), e) {
|
|
561
|
+
var E = (this.unsigned ? e.rem_u : e.rem_s)(
|
|
562
|
+
this.low,
|
|
563
|
+
this.high,
|
|
564
|
+
c.low,
|
|
565
|
+
c.high
|
|
566
|
+
);
|
|
567
|
+
return i(E, e.get_high(), this.unsigned);
|
|
568
|
+
}
|
|
569
|
+
return this.sub(this.div(c).mul(c));
|
|
570
|
+
}, x.mod = x.modulo, x.rem = x.modulo, x.not = function() {
|
|
571
|
+
return i(~this.low, ~this.high, this.unsigned);
|
|
572
|
+
}, x.and = function(c) {
|
|
573
|
+
return n(c) || (c = h(c)), i(this.low & c.low, this.high & c.high, this.unsigned);
|
|
574
|
+
}, x.or = function(c) {
|
|
575
|
+
return n(c) || (c = h(c)), i(this.low | c.low, this.high | c.high, this.unsigned);
|
|
576
|
+
}, x.xor = function(c) {
|
|
577
|
+
return n(c) || (c = h(c)), i(this.low ^ c.low, this.high ^ c.high, this.unsigned);
|
|
578
|
+
}, x.shiftLeft = function(c) {
|
|
579
|
+
return n(c) && (c = c.toInt()), (c &= 63) === 0 ? this : c < 32 ? i(this.low << c, this.high << c | this.low >>> 32 - c, this.unsigned) : i(0, this.low << c - 32, this.unsigned);
|
|
580
|
+
}, x.shl = x.shiftLeft, x.shiftRight = function(c) {
|
|
581
|
+
return n(c) && (c = c.toInt()), (c &= 63) === 0 ? this : c < 32 ? i(this.low >>> c | this.high << 32 - c, this.high >> c, this.unsigned) : i(this.high >> c - 32, this.high >= 0 ? 0 : -1, this.unsigned);
|
|
582
|
+
}, x.shr = x.shiftRight, x.shiftRightUnsigned = function(c) {
|
|
583
|
+
if (n(c) && (c = c.toInt()), c &= 63, c === 0)
|
|
584
|
+
return this;
|
|
585
|
+
var E = this.high;
|
|
586
|
+
if (c < 32) {
|
|
587
|
+
var N = this.low;
|
|
588
|
+
return i(N >>> c | E << 32 - c, E >>> c, this.unsigned);
|
|
589
|
+
} else return c === 32 ? i(E, 0, this.unsigned) : i(E >>> c - 32, 0, this.unsigned);
|
|
590
|
+
}, x.shru = x.shiftRightUnsigned, x.shr_u = x.shiftRightUnsigned, x.toSigned = function() {
|
|
591
|
+
return this.unsigned ? i(this.low, this.high, !1) : this;
|
|
592
|
+
}, x.toUnsigned = function() {
|
|
593
|
+
return this.unsigned ? this : i(this.low, this.high, !0);
|
|
594
|
+
}, x.toBytes = function(c) {
|
|
595
|
+
return c ? this.toBytesLE() : this.toBytesBE();
|
|
596
|
+
}, x.toBytesLE = function() {
|
|
597
|
+
var c = this.high, E = this.low;
|
|
598
|
+
return [
|
|
599
|
+
E & 255,
|
|
600
|
+
E >>> 8 & 255,
|
|
601
|
+
E >>> 16 & 255,
|
|
602
|
+
E >>> 24,
|
|
603
|
+
c & 255,
|
|
604
|
+
c >>> 8 & 255,
|
|
605
|
+
c >>> 16 & 255,
|
|
606
|
+
c >>> 24
|
|
607
|
+
];
|
|
608
|
+
}, x.toBytesBE = function() {
|
|
609
|
+
var c = this.high, E = this.low;
|
|
610
|
+
return [
|
|
611
|
+
c >>> 24,
|
|
612
|
+
c >>> 16 & 255,
|
|
613
|
+
c >>> 8 & 255,
|
|
614
|
+
c & 255,
|
|
615
|
+
E >>> 24,
|
|
616
|
+
E >>> 16 & 255,
|
|
617
|
+
E >>> 8 & 255,
|
|
618
|
+
E & 255
|
|
619
|
+
];
|
|
620
|
+
}, t.fromBytes = function(c, E, N) {
|
|
621
|
+
return N ? t.fromBytesLE(c, E) : t.fromBytesBE(c, E);
|
|
622
|
+
}, t.fromBytesLE = function(c, E) {
|
|
623
|
+
return new t(
|
|
624
|
+
c[0] | c[1] << 8 | c[2] << 16 | c[3] << 24,
|
|
625
|
+
c[4] | c[5] << 8 | c[6] << 16 | c[7] << 24,
|
|
626
|
+
E
|
|
627
|
+
);
|
|
628
|
+
}, t.fromBytesBE = function(c, E) {
|
|
629
|
+
return new t(
|
|
630
|
+
c[4] << 24 | c[5] << 16 | c[6] << 8 | c[7],
|
|
631
|
+
c[0] << 24 | c[1] << 16 | c[2] << 8 | c[3],
|
|
632
|
+
E
|
|
633
|
+
);
|
|
634
|
+
}, It;
|
|
635
|
+
}
|
|
636
|
+
var oe = Tn();
|
|
637
|
+
const re = /* @__PURE__ */ Sn(oe), Rn = /* @__PURE__ */ vn({
|
|
638
|
+
__proto__: null,
|
|
639
|
+
default: re
|
|
640
|
+
}, [oe]);
|
|
641
|
+
/**
|
|
642
|
+
* @license
|
|
643
|
+
* Copyright 2021 Google LLC. All Rights Reserved.
|
|
644
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
645
|
+
* you may not use this file except in compliance with the License.
|
|
646
|
+
* You may obtain a copy of the License at
|
|
647
|
+
*
|
|
648
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
649
|
+
*
|
|
650
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
651
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
652
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
653
|
+
* See the License for the specific language governing permissions and
|
|
654
|
+
* limitations under the License.
|
|
655
|
+
* =============================================================================
|
|
656
|
+
*/
|
|
657
|
+
const tt = (
|
|
658
|
+
// tslint:disable-next-line
|
|
659
|
+
re || Rn
|
|
660
|
+
);
|
|
661
|
+
function dt(e) {
|
|
662
|
+
return tt.fromString(e, !0, 16);
|
|
663
|
+
}
|
|
664
|
+
const ae = dt("c3a5c85c97cb3127"), Q = dt("b492b66fbe98f273"), V = dt("9ae16a3b2f90404f");
|
|
665
|
+
function bt(e) {
|
|
666
|
+
return e.xor(e.shru(47));
|
|
667
|
+
}
|
|
668
|
+
function ie(e, t, n) {
|
|
669
|
+
const s = e.slice(t, t + n);
|
|
670
|
+
return tt.fromBytes(Array.from(s), !0, !0);
|
|
671
|
+
}
|
|
672
|
+
function T(e, t) {
|
|
673
|
+
return ie(e, t, 8);
|
|
674
|
+
}
|
|
675
|
+
function vt(e, t) {
|
|
676
|
+
return ie(e, t, 4);
|
|
677
|
+
}
|
|
678
|
+
function O(e, t) {
|
|
679
|
+
return t === 0 ? e : e.shru(t).or(e.shl(64 - t));
|
|
680
|
+
}
|
|
681
|
+
function Y(e, t, n = dt("9ddfea08eb382d69")) {
|
|
682
|
+
let s = e.xor(t).mul(n);
|
|
683
|
+
s = s.xor(s.shru(47));
|
|
684
|
+
let o = t.xor(s).mul(n);
|
|
685
|
+
return o = o.xor(o.shru(47)), o = o.mul(n), o;
|
|
686
|
+
}
|
|
687
|
+
function Pn(e, t, n, s, o, a) {
|
|
688
|
+
o = o.add(e), a = O(a.add(o).add(s), 21);
|
|
689
|
+
const r = o;
|
|
690
|
+
return o = o.add(t), o = o.add(n), a = a.add(O(o, 44)), [o.add(s), a.add(r)];
|
|
691
|
+
}
|
|
692
|
+
function ut(e, t, n, s) {
|
|
693
|
+
return Pn(T(e, t), T(e, t + 8), T(e, t + 16), T(e, t + 24), n, s);
|
|
694
|
+
}
|
|
695
|
+
function Cn(e, t = e.length) {
|
|
696
|
+
if (t >= 8) {
|
|
697
|
+
const n = V.add(t * 2), s = T(e, 0).add(V), o = T(e, t - 8), a = O(o, 37).mul(n).add(s), r = O(s, 25).add(o).mul(n);
|
|
698
|
+
return Y(a, r, n);
|
|
699
|
+
}
|
|
700
|
+
if (t >= 4) {
|
|
701
|
+
const n = V.add(t * 2), s = vt(e, 0);
|
|
702
|
+
return Y(s.shl(3).add(t), vt(e, t - 4), n);
|
|
703
|
+
}
|
|
704
|
+
if (t > 0) {
|
|
705
|
+
const n = e[0], s = e[t >> 1], o = e[t - 1], a = n + (s << 8), r = t + (o << 2);
|
|
706
|
+
return bt(V.mul(a).xor(ae.mul(r))).mul(V);
|
|
707
|
+
}
|
|
708
|
+
return V;
|
|
709
|
+
}
|
|
710
|
+
function qn(e, t = e.length) {
|
|
711
|
+
const n = V.add(t * 2), s = T(e, 0).mul(Q), o = T(e, 8), a = T(e, t - 8).mul(n), r = T(e, t - 16).mul(V);
|
|
712
|
+
return Y(O(s.add(o), 43).add(O(a, 30)).add(r), s.add(O(o.add(V), 18)).add(a), n);
|
|
713
|
+
}
|
|
714
|
+
function Un(e, t = e.length) {
|
|
715
|
+
const n = V.add(t * 2), s = T(e, 0).mul(V), o = T(e, 8), a = T(e, t - 8).mul(n), r = T(e, t - 16).mul(V), i = O(s.add(o), 43).add(O(a, 30)).add(r), l = Y(i, s.add(O(o.add(V), 18)).add(a), n), u = T(e, 16).mul(n), h = T(e, 24), f = i.add(T(e, t - 32)).mul(n), p = l.add(T(e, t - 24)).mul(n);
|
|
716
|
+
return Y(O(u.add(h), 43).add(O(f, 30)).add(p), u.add(O(h.add(s), 18)).add(f), n);
|
|
717
|
+
}
|
|
718
|
+
function Mn(e, t = e.length) {
|
|
719
|
+
const n = tt.fromNumber(81, !0);
|
|
720
|
+
if (t <= 32)
|
|
721
|
+
return t <= 16 ? Cn(e, t) : qn(e, t);
|
|
722
|
+
if (t <= 64)
|
|
723
|
+
return Un(e, t);
|
|
724
|
+
let s = n, o = n.mul(Q).add(113), a = bt(o.mul(V).add(113)).mul(V), r = [tt.UZERO, tt.UZERO], i = [tt.UZERO, tt.UZERO];
|
|
725
|
+
s = s.mul(V).add(T(e, 0));
|
|
726
|
+
let l = 0;
|
|
727
|
+
const u = (t - 1 >> 6) * 64, h = u + (t - 1 & 63) - 63;
|
|
728
|
+
do
|
|
729
|
+
s = O(s.add(o).add(r[0]).add(T(e, l + 8)), 37).mul(Q), o = O(o.add(r[1]).add(T(e, l + 48)), 42).mul(Q), s = s.xor(i[1]), o = o.add(r[0]).add(T(e, l + 40)), a = O(a.add(i[0]), 33).mul(Q), r = ut(e, l, r[1].mul(Q), s.add(i[0])), i = ut(e, l + 32, a.add(i[1]), o.add(T(e, l + 16))), [a, s] = [s, a], l += 64;
|
|
730
|
+
while (l !== u);
|
|
731
|
+
const f = Q.add(a.and(255).shl(1));
|
|
732
|
+
return l = h, i[0] = i[0].add(t - 1 & 63), r[0] = r[0].add(i[0]), i[0] = i[0].add(r[0]), s = O(s.add(o).add(r[0]).add(T(e, l + 8)), 37).mul(f), o = O(o.add(r[1]).add(T(e, l + 48)), 42).mul(f), s = s.xor(i[1].mul(9)), o = o.add(r[0].mul(9).add(T(e, l + 40))), a = O(a.add(i[0]), 33).mul(f), r = ut(e, l, r[1].mul(f), s.add(i[0])), i = ut(e, l + 32, a.add(i[1]), o.add(T(e, l + 16))), [a, s] = [s, a], Y(Y(r[0], i[0], f).add(bt(o).mul(ae)).add(a), Y(r[1], i[1], f).add(s), f);
|
|
733
|
+
}
|
|
734
|
+
/**
|
|
735
|
+
* @license
|
|
736
|
+
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
737
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
738
|
+
* you may not use this file except in compliance with the License.
|
|
739
|
+
* You may obtain a copy of the License at
|
|
740
|
+
*
|
|
741
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
742
|
+
*
|
|
743
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
744
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
745
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
746
|
+
* See the License for the specific language governing permissions and
|
|
747
|
+
* limitations under the License.
|
|
748
|
+
* =============================================================================
|
|
749
|
+
*/
|
|
750
|
+
function nt(e, t) {
|
|
751
|
+
Array.isArray(e) || (e = [e]), e.forEach((n) => {
|
|
752
|
+
n != null && qt(n.dtype !== "complex64", () => `${t} does not support complex64 tensors in the CPU backend.`);
|
|
753
|
+
});
|
|
754
|
+
}
|
|
755
|
+
/**
|
|
756
|
+
* @license
|
|
757
|
+
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
758
|
+
* Licensed under the Apache License, Version 2.0 (the License);
|
|
759
|
+
* you may not use this file except in compliance with the License.
|
|
760
|
+
* You may obtain a copy of the License at
|
|
761
|
+
*
|
|
762
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
763
|
+
*
|
|
764
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
765
|
+
* distributed under the License is distributed on an AS IS BASIS,
|
|
766
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
767
|
+
* See the License for the specific language governing permissions and
|
|
768
|
+
* limitations under the License.
|
|
769
|
+
* =============================================================================
|
|
770
|
+
*/
|
|
771
|
+
function le(e) {
|
|
772
|
+
const t = new Float32Array(e.length);
|
|
773
|
+
for (let n = 0; n < e.length; ++n)
|
|
774
|
+
t[n] = Math.abs(e[n]);
|
|
775
|
+
return t;
|
|
776
|
+
}
|
|
777
|
+
const On = (e) => {
|
|
778
|
+
const { x: t } = e.inputs, n = e.backend;
|
|
779
|
+
nt(t, "abs");
|
|
780
|
+
let s = new Float32Array(A(t.shape));
|
|
781
|
+
const o = n.data.get(t.dataId).values;
|
|
782
|
+
return s = le(o), n.makeOutput(s, t.shape, t.dtype);
|
|
783
|
+
}, Ys = {
|
|
784
|
+
kernelName: _e,
|
|
785
|
+
backendName: "cpu",
|
|
786
|
+
kernelFunc: On
|
|
787
|
+
};
|
|
788
|
+
/**
|
|
789
|
+
* @license
|
|
790
|
+
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
791
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
792
|
+
* you may not use this file except in compliance with the License.
|
|
793
|
+
* You may obtain a copy of the License at
|
|
794
|
+
*
|
|
795
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
796
|
+
*
|
|
797
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
798
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
799
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
800
|
+
* See the License for the specific language governing permissions and
|
|
801
|
+
* limitations under the License.
|
|
802
|
+
* =============================================================================
|
|
803
|
+
*/
|
|
804
|
+
function W(e) {
|
|
805
|
+
return (t, n, s, o, a) => {
|
|
806
|
+
const r = Ut(t, n), i = r.length, l = K(r), u = A(r), h = et(a, u), f = t.length, p = n.length, I = K(t), m = K(n), F = ht(t, r), g = ht(n, r);
|
|
807
|
+
if (F.length + g.length === 0)
|
|
808
|
+
for (let d = 0; d < h.length; ++d)
|
|
809
|
+
h[d] = e(s[d % s.length], o[d % o.length]);
|
|
810
|
+
else
|
|
811
|
+
for (let d = 0; d < h.length; ++d) {
|
|
812
|
+
const b = gt(d, i, l), k = b.slice(-f);
|
|
813
|
+
F.forEach((C) => k[C] = 0);
|
|
814
|
+
const y = at(k, f, I), S = b.slice(-p);
|
|
815
|
+
g.forEach((C) => S[C] = 0);
|
|
816
|
+
const P = at(S, p, m);
|
|
817
|
+
h[d] = e(s[y], o[P]);
|
|
818
|
+
}
|
|
819
|
+
return [h, r];
|
|
820
|
+
};
|
|
821
|
+
}
|
|
822
|
+
/**
|
|
823
|
+
* @license
|
|
824
|
+
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
825
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
826
|
+
* you may not use this file except in compliance with the License.
|
|
827
|
+
* You may obtain a copy of the License at
|
|
828
|
+
*
|
|
829
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
830
|
+
*
|
|
831
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
832
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
833
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
834
|
+
* See the License for the specific language governing permissions and
|
|
835
|
+
* limitations under the License.
|
|
836
|
+
* =============================================================================
|
|
837
|
+
*/
|
|
838
|
+
function mt(e) {
|
|
839
|
+
const { inputs: t, backend: n } = e, { real: s, imag: o } = t, a = n.data.get(s.dataId).values, r = n.data.get(o.dataId).values, i = n.makeTensorInfo(s.shape, "complex64"), l = n.data.get(i.dataId);
|
|
840
|
+
return l.complexTensorInfos = {
|
|
841
|
+
real: n.makeTensorInfo(s.shape, "float32", a),
|
|
842
|
+
imag: n.makeTensorInfo(o.shape, "float32", r)
|
|
843
|
+
}, i;
|
|
844
|
+
}
|
|
845
|
+
const Js = {
|
|
846
|
+
kernelName: Ve,
|
|
847
|
+
backendName: "cpu",
|
|
848
|
+
kernelFunc: mt
|
|
849
|
+
};
|
|
850
|
+
/**
|
|
851
|
+
* @license
|
|
852
|
+
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
853
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
854
|
+
* you may not use this file except in compliance with the License.
|
|
855
|
+
* You may obtain a copy of the License at
|
|
856
|
+
*
|
|
857
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
858
|
+
*
|
|
859
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
860
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
861
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
862
|
+
* See the License for the specific language governing permissions and
|
|
863
|
+
* limitations under the License.
|
|
864
|
+
* =============================================================================
|
|
865
|
+
*/
|
|
866
|
+
function xt(e, t, n = "float32") {
|
|
867
|
+
if (n === "complex64") {
|
|
868
|
+
const o = xt(e, t, "float32"), a = xt(e, t, "float32");
|
|
869
|
+
return mt({ inputs: { real: o, imag: a }, backend: e });
|
|
870
|
+
}
|
|
871
|
+
const s = st(A(t), n);
|
|
872
|
+
return e.makeTensorInfo(t, n, s);
|
|
873
|
+
}
|
|
874
|
+
/**
|
|
875
|
+
* @license
|
|
876
|
+
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
877
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
878
|
+
* you may not use this file except in compliance with the License.
|
|
879
|
+
* You may obtain a copy of the License at
|
|
880
|
+
*
|
|
881
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
882
|
+
*
|
|
883
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
884
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
885
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
886
|
+
* See the License for the specific language governing permissions and
|
|
887
|
+
* limitations under the License.
|
|
888
|
+
* =============================================================================
|
|
889
|
+
*/
|
|
890
|
+
function Et(e) {
|
|
891
|
+
const { inputs: t, backend: n } = e, { x: s } = t;
|
|
892
|
+
return n.incRef(s.dataId), { dataId: s.dataId, shape: s.shape, dtype: s.dtype };
|
|
893
|
+
}
|
|
894
|
+
const Qs = {
|
|
895
|
+
kernelName: De,
|
|
896
|
+
backendName: "cpu",
|
|
897
|
+
kernelFunc: Et
|
|
898
|
+
};
|
|
899
|
+
/**
|
|
900
|
+
* @license
|
|
901
|
+
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
902
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
903
|
+
* you may not use this file except in compliance with the License.
|
|
904
|
+
* You may obtain a copy of the License at
|
|
905
|
+
*
|
|
906
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
907
|
+
*
|
|
908
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
909
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
910
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
911
|
+
* See the License for the specific language governing permissions and
|
|
912
|
+
* limitations under the License.
|
|
913
|
+
* =============================================================================
|
|
914
|
+
*/
|
|
915
|
+
function ce(e) {
|
|
916
|
+
const { inputs: t, backend: n } = e, { input: s } = t, o = n.data.get(s.dataId).complexTensorInfos.real, a = n.data.get(o.dataId).values;
|
|
917
|
+
return n.makeTensorInfo(o.shape, o.dtype, a);
|
|
918
|
+
}
|
|
919
|
+
const to = {
|
|
920
|
+
kernelName: We,
|
|
921
|
+
backendName: "cpu",
|
|
922
|
+
kernelFunc: ce
|
|
923
|
+
};
|
|
924
|
+
/**
|
|
925
|
+
* @license
|
|
926
|
+
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
927
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
928
|
+
* you may not use this file except in compliance with the License.
|
|
929
|
+
* You may obtain a copy of the License at
|
|
930
|
+
*
|
|
931
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
932
|
+
*
|
|
933
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
934
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
935
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
936
|
+
* See the License for the specific language governing permissions and
|
|
937
|
+
* limitations under the License.
|
|
938
|
+
* =============================================================================
|
|
939
|
+
*/
|
|
940
|
+
function ue(e, t, n, s) {
|
|
941
|
+
if (s === "int32") {
|
|
942
|
+
const o = Int32Array.from(e);
|
|
943
|
+
return [t, "int32", o];
|
|
944
|
+
}
|
|
945
|
+
if (s === "bool") {
|
|
946
|
+
const o = Be([0], n), [a, r] = W((i, l) => i !== l ? 1 : 0)(t, [], e, o, "bool");
|
|
947
|
+
return [r, "bool", a];
|
|
948
|
+
}
|
|
949
|
+
throw new Error(`Error in Cast: failed to cast ${n} to ${s}`);
|
|
950
|
+
}
|
|
951
|
+
function lt(e) {
|
|
952
|
+
const { inputs: t, backend: n, attrs: s } = e, { x: o } = t, { dtype: a } = s;
|
|
953
|
+
if (a === "complex64") {
|
|
954
|
+
if (o.dtype === "complex64")
|
|
955
|
+
return Et({ inputs: { x: o }, backend: n });
|
|
956
|
+
const h = xt(n, o.shape, o.dtype), f = lt({ inputs: { x: o }, backend: n, attrs: { dtype: "float32" } }), p = mt({ inputs: { real: f, imag: h }, backend: n });
|
|
957
|
+
return n.disposeIntermediateTensorInfo(h), n.disposeIntermediateTensorInfo(f), p;
|
|
958
|
+
}
|
|
959
|
+
if (o.dtype === "complex64") {
|
|
960
|
+
const h = ce({ inputs: { input: o }, backend: n }), f = lt({ inputs: { x: h }, backend: n, attrs: { dtype: a } });
|
|
961
|
+
return n.disposeIntermediateTensorInfo(h), f;
|
|
962
|
+
}
|
|
963
|
+
if (!ze(o.dtype, a)) {
|
|
964
|
+
const h = Et({ inputs: { x: o }, backend: n });
|
|
965
|
+
return { dataId: h.dataId, shape: h.shape, dtype: a };
|
|
966
|
+
}
|
|
967
|
+
const r = n.data.get(o.dataId).values, [i, l, u] = ue(r, o.shape, o.dtype, a);
|
|
968
|
+
return n.makeTensorInfo(i, l, u);
|
|
969
|
+
}
|
|
970
|
+
const eo = {
|
|
971
|
+
kernelName: $e,
|
|
972
|
+
backendName: "cpu",
|
|
973
|
+
kernelFunc: lt
|
|
974
|
+
};
|
|
975
|
+
/**
|
|
976
|
+
* @license
|
|
977
|
+
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
978
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
979
|
+
* you may not use this file except in compliance with the License.
|
|
980
|
+
* You may obtain a copy of the License at
|
|
981
|
+
*
|
|
982
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
983
|
+
*
|
|
984
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
985
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
986
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
987
|
+
* See the License for the specific language governing permissions and
|
|
988
|
+
* limitations under the License.
|
|
989
|
+
* =============================================================================
|
|
990
|
+
*/
|
|
991
|
+
function z(e, t, n, s) {
|
|
992
|
+
return n == null ? ({ inputs: o, backend: a }) => {
|
|
993
|
+
const { a: r, b: i } = o, l = a;
|
|
994
|
+
nt([r, i], e);
|
|
995
|
+
const u = l.data.get(r.dataId).values, h = l.data.get(i.dataId).values, f = r.dtype === "string" ? (
|
|
996
|
+
// tslint:disable-next-line: no-any
|
|
997
|
+
it(u)
|
|
998
|
+
) : u, p = r.dtype === "string" ? (
|
|
999
|
+
// tslint:disable-next-line: no-any
|
|
1000
|
+
it(h)
|
|
1001
|
+
) : h, I = s || r.dtype, [m, F] = t(r.shape, i.shape, f, p, I);
|
|
1002
|
+
return l.makeTensorInfo(F, I, m);
|
|
1003
|
+
} : ({ inputs: o, backend: a }) => {
|
|
1004
|
+
const { a: r, b: i } = o, l = a;
|
|
1005
|
+
if (r.dtype === "complex64" || i.dtype === "complex64") {
|
|
1006
|
+
const u = lt({ inputs: { x: r }, backend: l, attrs: { dtype: "complex64" } }), h = l.data.get(u.dataId), f = h.complexTensorInfos.real, p = h.complexTensorInfos.imag, I = l.data.get(f.dataId).values, m = l.data.get(p.dataId).values, F = lt({ inputs: { x: i }, backend: l, attrs: { dtype: "complex64" } }), g = l.data.get(F.dataId), d = g.complexTensorInfos.real, b = g.complexTensorInfos.imag, k = l.data.get(d.dataId).values, y = l.data.get(b.dataId).values, [S, P, C] = n(r.shape, i.shape, I, m, k, y), v = l.makeTensorInfo(C, "float32", S), x = l.makeTensorInfo(C, "float32", P), w = mt({ inputs: { real: v, imag: x }, backend: l });
|
|
1007
|
+
return l.disposeIntermediateTensorInfo(u), l.disposeIntermediateTensorInfo(F), l.disposeIntermediateTensorInfo(v), l.disposeIntermediateTensorInfo(x), w;
|
|
1008
|
+
} else {
|
|
1009
|
+
const u = l.data.get(r.dataId).values, h = l.data.get(i.dataId).values, f = s || r.dtype, [p, I] = t(r.shape, i.shape, u, h, f);
|
|
1010
|
+
return l.makeTensorInfo(I, f, p);
|
|
1011
|
+
}
|
|
1012
|
+
};
|
|
1013
|
+
}
|
|
1014
|
+
function Ft(e) {
|
|
1015
|
+
return (t, n, s, o, a, r) => {
|
|
1016
|
+
const i = Ut(t, n), l = A(i), u = i.length, h = K(i), f = et("float32", l), p = et("float32", l), I = ht(t, i), m = ht(n, i), F = kt(s, o), g = kt(a, r), d = t.length, b = K(t), k = n.length, y = K(n);
|
|
1017
|
+
if (I.length + m.length === 0)
|
|
1018
|
+
for (let S = 0; S < f.length; S++) {
|
|
1019
|
+
const P = S % F.length, C = S % g.length, v = e(F[P * 2], F[P * 2 + 1], g[C * 2], g[C * 2 + 1]);
|
|
1020
|
+
f[S] = v.real, p[S] = v.imag;
|
|
1021
|
+
}
|
|
1022
|
+
else
|
|
1023
|
+
for (let S = 0; S < f.length; S++) {
|
|
1024
|
+
const P = gt(S, u, h), C = P.slice(-d);
|
|
1025
|
+
I.forEach((E) => C[E] = 0);
|
|
1026
|
+
const v = at(C, d, b), x = P.slice(-k);
|
|
1027
|
+
m.forEach((E) => x[E] = 0);
|
|
1028
|
+
const w = at(x, k, y), c = e(F[v * 2], F[v * 2 + 1], g[w * 2], g[w * 2 + 1]);
|
|
1029
|
+
f[S] = c.real, p[S] = c.imag;
|
|
1030
|
+
}
|
|
1031
|
+
return [f, p, i];
|
|
1032
|
+
};
|
|
1033
|
+
}
|
|
1034
|
+
/**
|
|
1035
|
+
* @license
|
|
1036
|
+
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
1037
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1038
|
+
* you may not use this file except in compliance with the License.
|
|
1039
|
+
* You may obtain a copy of the License at
|
|
1040
|
+
*
|
|
1041
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1042
|
+
*
|
|
1043
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1044
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1045
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1046
|
+
* See the License for the specific language governing permissions and
|
|
1047
|
+
* limitations under the License.
|
|
1048
|
+
* =============================================================================
|
|
1049
|
+
*/
|
|
1050
|
+
const he = W((e, t) => e + t), Ln = Ft((e, t, n, s) => ({ real: e + n, imag: t + s })), An = z(Mt, he, Ln), no = {
|
|
1051
|
+
kernelName: Mt,
|
|
1052
|
+
backendName: "cpu",
|
|
1053
|
+
kernelFunc: An
|
|
1054
|
+
};
|
|
1055
|
+
/**
|
|
1056
|
+
* @license
|
|
1057
|
+
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
1058
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1059
|
+
* you may not use this file except in compliance with the License.
|
|
1060
|
+
* You may obtain a copy of the License at
|
|
1061
|
+
*
|
|
1062
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1063
|
+
*
|
|
1064
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1065
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1066
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1067
|
+
* See the License for the specific language governing permissions and
|
|
1068
|
+
* limitations under the License.
|
|
1069
|
+
* =============================================================================
|
|
1070
|
+
*/
|
|
1071
|
+
function _n(e, t, n, s, o) {
|
|
1072
|
+
const a = A(s), r = st(o, n);
|
|
1073
|
+
for (let i = 0; i < e.length; i++) {
|
|
1074
|
+
const l = e[i];
|
|
1075
|
+
if (l < 0)
|
|
1076
|
+
throw new Error("Input x must be non-negative!");
|
|
1077
|
+
l >= o || (a > 0 ? r[l] += t[i] : r[l] += 1);
|
|
1078
|
+
}
|
|
1079
|
+
return r;
|
|
1080
|
+
}
|
|
1081
|
+
function Vn(e, t, n, s = !1) {
|
|
1082
|
+
const o = e.shape[0], a = e.shape[1], r = H([o, n], t.dtype);
|
|
1083
|
+
for (let i = 0; i < o; i++)
|
|
1084
|
+
for (let l = 0; l < a; l++) {
|
|
1085
|
+
const u = e.get(i, l);
|
|
1086
|
+
if (u < 0)
|
|
1087
|
+
throw new Error("Input x must be non-negative!");
|
|
1088
|
+
u >= n || (s ? r.set(1, i, u) : t.size > 0 ? r.set(r.get(i, u) + t.get(i, l), i, u) : r.set(r.get(i, u) + 1, i, u));
|
|
1089
|
+
}
|
|
1090
|
+
return r;
|
|
1091
|
+
}
|
|
1092
|
+
/**
|
|
1093
|
+
* @license
|
|
1094
|
+
* Copyright 2023 Google LLC.
|
|
1095
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1096
|
+
* you may not use this file except in compliance with the License.
|
|
1097
|
+
* You may obtain a copy of the License at
|
|
1098
|
+
*
|
|
1099
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1100
|
+
*
|
|
1101
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1102
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1103
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1104
|
+
* See the License for the specific language governing permissions and
|
|
1105
|
+
* limitations under the License.
|
|
1106
|
+
* =============================================================================
|
|
1107
|
+
*/
|
|
1108
|
+
const fe = W((e, t) => e & t), Dn = z(Ot, fe), so = {
|
|
1109
|
+
kernelName: Ot,
|
|
1110
|
+
backendName: "cpu",
|
|
1111
|
+
kernelFunc: Dn
|
|
1112
|
+
};
|
|
1113
|
+
/**
|
|
1114
|
+
* @license
|
|
1115
|
+
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
1116
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1117
|
+
* you may not use this file except in compliance with the License.
|
|
1118
|
+
* You may obtain a copy of the License at
|
|
1119
|
+
*
|
|
1120
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1121
|
+
*
|
|
1122
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1123
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1124
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1125
|
+
* See the License for the specific language governing permissions and
|
|
1126
|
+
* limitations under the License.
|
|
1127
|
+
* =============================================================================
|
|
1128
|
+
*/
|
|
1129
|
+
function X(e) {
|
|
1130
|
+
return (t, n, s) => {
|
|
1131
|
+
const o = D(n, t.length);
|
|
1132
|
+
for (let a = 0; a < t.length; ++a)
|
|
1133
|
+
o[a] = e(t[a], s);
|
|
1134
|
+
return o;
|
|
1135
|
+
};
|
|
1136
|
+
}
|
|
1137
|
+
/**
|
|
1138
|
+
* @license
|
|
1139
|
+
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
1140
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1141
|
+
* you may not use this file except in compliance with the License.
|
|
1142
|
+
* You may obtain a copy of the License at
|
|
1143
|
+
*
|
|
1144
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1145
|
+
*
|
|
1146
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1147
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1148
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1149
|
+
* See the License for the specific language governing permissions and
|
|
1150
|
+
* limitations under the License.
|
|
1151
|
+
* =============================================================================
|
|
1152
|
+
*/
|
|
1153
|
+
function ge(e, t, n) {
|
|
1154
|
+
const s = X(t);
|
|
1155
|
+
return J(e, s, n);
|
|
1156
|
+
}
|
|
1157
|
+
function J(e, t, n) {
|
|
1158
|
+
return ({ inputs: s, attrs: o, backend: a }) => {
|
|
1159
|
+
const { x: r } = s;
|
|
1160
|
+
nt(r, e);
|
|
1161
|
+
const i = a, l = i.data.get(r.dataId).values;
|
|
1162
|
+
let u;
|
|
1163
|
+
if (r.dtype === "string") {
|
|
1164
|
+
if (!Array.isArray(l))
|
|
1165
|
+
throw new Error("String tensor's value was not an instance of Array");
|
|
1166
|
+
u = it(l);
|
|
1167
|
+
} else
|
|
1168
|
+
u = l;
|
|
1169
|
+
const h = n || r.dtype, f = t(u, h, o);
|
|
1170
|
+
return i.makeTensorInfo(r.shape, h, f);
|
|
1171
|
+
};
|
|
1172
|
+
}
|
|
1173
|
+
/**
|
|
1174
|
+
* @license
|
|
1175
|
+
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
1176
|
+
* Licensed under the Apache License, Version 2.0 (the License);
|
|
1177
|
+
* you may not use this file except in compliance with the License.
|
|
1178
|
+
* You may obtain a copy of the License at
|
|
1179
|
+
*
|
|
1180
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1181
|
+
*
|
|
1182
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1183
|
+
* distributed under the License is distributed on an AS IS BASIS,
|
|
1184
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1185
|
+
* See the License for the specific language governing permissions and
|
|
1186
|
+
* limitations under the License.
|
|
1187
|
+
* =============================================================================
|
|
1188
|
+
*/
|
|
1189
|
+
const de = X((e) => Math.ceil(e)), Wn = J(Lt, de), oo = {
|
|
1190
|
+
kernelName: Lt,
|
|
1191
|
+
backendName: "cpu",
|
|
1192
|
+
kernelFunc: Wn
|
|
1193
|
+
};
|
|
1194
|
+
/**
|
|
1195
|
+
* @license
|
|
1196
|
+
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
1197
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1198
|
+
* you may not use this file except in compliance with the License.
|
|
1199
|
+
* You may obtain a copy of the License at
|
|
1200
|
+
*
|
|
1201
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1202
|
+
*
|
|
1203
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1204
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1205
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1206
|
+
* See the License for the specific language governing permissions and
|
|
1207
|
+
* limitations under the License.
|
|
1208
|
+
* =============================================================================
|
|
1209
|
+
*/
|
|
1210
|
+
function $n(e, t, n, s) {
|
|
1211
|
+
const o = D(n, A(t));
|
|
1212
|
+
if (s && n !== "string") {
|
|
1213
|
+
let a = 0;
|
|
1214
|
+
e.forEach((r) => {
|
|
1215
|
+
const i = A(r.shape);
|
|
1216
|
+
o.set(r.vals, a), a += i;
|
|
1217
|
+
});
|
|
1218
|
+
} else {
|
|
1219
|
+
let a = 0;
|
|
1220
|
+
e.forEach((r) => {
|
|
1221
|
+
const i = n === "string" ? it(r.vals) : r.vals;
|
|
1222
|
+
let l = 0;
|
|
1223
|
+
for (let u = 0; u < r.shape[0]; ++u) {
|
|
1224
|
+
const h = u * t[1] + a;
|
|
1225
|
+
for (let f = 0; f < r.shape[1]; ++f)
|
|
1226
|
+
o[h + f] = i[l++];
|
|
1227
|
+
}
|
|
1228
|
+
a += r.shape[1];
|
|
1229
|
+
});
|
|
1230
|
+
}
|
|
1231
|
+
return o;
|
|
1232
|
+
}
|
|
1233
|
+
/**
|
|
1234
|
+
* @license
|
|
1235
|
+
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
1236
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1237
|
+
* you may not use this file except in compliance with the License.
|
|
1238
|
+
* You may obtain a copy of the License at
|
|
1239
|
+
*
|
|
1240
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1241
|
+
*
|
|
1242
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1243
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1244
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1245
|
+
* See the License for the specific language governing permissions and
|
|
1246
|
+
* limitations under the License.
|
|
1247
|
+
* =============================================================================
|
|
1248
|
+
*/
|
|
1249
|
+
const me = W((e, t) => e === t ? 1 : 0), zn = z(At, me, null, "bool"), ro = {
|
|
1250
|
+
kernelName: At,
|
|
1251
|
+
backendName: "cpu",
|
|
1252
|
+
kernelFunc: zn
|
|
1253
|
+
};
|
|
1254
|
+
/**
|
|
1255
|
+
* @license
|
|
1256
|
+
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
1257
|
+
* Licensed under the Apache License, Version 2.0 (the License);
|
|
1258
|
+
* you may not use this file except in compliance with the License.
|
|
1259
|
+
* You may obtain a copy of the License at
|
|
1260
|
+
*
|
|
1261
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1262
|
+
*
|
|
1263
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1264
|
+
* distributed under the License is distributed on an AS IS BASIS,
|
|
1265
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1266
|
+
* See the License for the specific language governing permissions and
|
|
1267
|
+
* limitations under the License.
|
|
1268
|
+
* =============================================================================
|
|
1269
|
+
*/
|
|
1270
|
+
const pe = X((e) => Math.exp(e)), Bn = J(_t, pe, "float32"), ao = {
|
|
1271
|
+
kernelName: _t,
|
|
1272
|
+
backendName: "cpu",
|
|
1273
|
+
kernelFunc: Bn
|
|
1274
|
+
};
|
|
1275
|
+
/**
|
|
1276
|
+
* @license
|
|
1277
|
+
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
1278
|
+
* Licensed under the Apache License, Version 2.0 (the License);
|
|
1279
|
+
* you may not use this file except in compliance with the License.
|
|
1280
|
+
* You may obtain a copy of the License at
|
|
1281
|
+
*
|
|
1282
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1283
|
+
*
|
|
1284
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1285
|
+
* distributed under the License is distributed on an AS IS BASIS,
|
|
1286
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1287
|
+
* See the License for the specific language governing permissions and
|
|
1288
|
+
* limitations under the License.
|
|
1289
|
+
* =============================================================================
|
|
1290
|
+
*/
|
|
1291
|
+
const Ie = X((e) => Math.expm1(e)), Gn = J(Vt, Ie), io = {
|
|
1292
|
+
kernelName: Vt,
|
|
1293
|
+
backendName: "cpu",
|
|
1294
|
+
kernelFunc: Gn
|
|
1295
|
+
};
|
|
1296
|
+
/**
|
|
1297
|
+
* @license
|
|
1298
|
+
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
1299
|
+
* Licensed under the Apache License, Version 2.0 (the License);
|
|
1300
|
+
* you may not use this file except in compliance with the License.
|
|
1301
|
+
* You may obtain a copy of the License at
|
|
1302
|
+
*
|
|
1303
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1304
|
+
*
|
|
1305
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1306
|
+
* distributed under the License is distributed on an AS IS BASIS,
|
|
1307
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1308
|
+
* See the License for the specific language governing permissions and
|
|
1309
|
+
* limitations under the License.
|
|
1310
|
+
* =============================================================================
|
|
1311
|
+
*/
|
|
1312
|
+
const we = X((e) => Math.floor(e)), jn = J(Dt, we), lo = {
|
|
1313
|
+
kernelName: Dt,
|
|
1314
|
+
backendName: "cpu",
|
|
1315
|
+
kernelFunc: jn
|
|
1316
|
+
};
|
|
1317
|
+
/**
|
|
1318
|
+
* @license
|
|
1319
|
+
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
1320
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1321
|
+
* you may not use this file except in compliance with the License.
|
|
1322
|
+
* You may obtain a copy of the License at
|
|
1323
|
+
*
|
|
1324
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1325
|
+
*
|
|
1326
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1327
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1328
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1329
|
+
* See the License for the specific language governing permissions and
|
|
1330
|
+
* limitations under the License.
|
|
1331
|
+
* =============================================================================
|
|
1332
|
+
*/
|
|
1333
|
+
const be = W((e, t) => Math.floor(e / t)), Zn = z(Wt, be, null, "int32"), co = {
|
|
1334
|
+
kernelName: Wt,
|
|
1335
|
+
backendName: "cpu",
|
|
1336
|
+
kernelFunc: Zn
|
|
1337
|
+
};
|
|
1338
|
+
/**
|
|
1339
|
+
* @license
|
|
1340
|
+
* Copyright 2021 Google LLC. All Rights Reserved.
|
|
1341
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1342
|
+
* you may not use this file except in compliance with the License.
|
|
1343
|
+
* You may obtain a copy of the License at
|
|
1344
|
+
*
|
|
1345
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1346
|
+
*
|
|
1347
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1348
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1349
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1350
|
+
* See the License for the specific language governing permissions and
|
|
1351
|
+
* limitations under the License.
|
|
1352
|
+
* =============================================================================
|
|
1353
|
+
*/
|
|
1354
|
+
function Hn(e, t, n, s, o, a, r, i, l) {
|
|
1355
|
+
const u = H([s, a], n);
|
|
1356
|
+
for (let h = 0; h < s; h++) {
|
|
1357
|
+
const f = [];
|
|
1358
|
+
let p = 0;
|
|
1359
|
+
for (let I = 0; I < o; I++) {
|
|
1360
|
+
const m = e[h * o + I];
|
|
1361
|
+
p += m * r[I], f.push(m);
|
|
1362
|
+
}
|
|
1363
|
+
if (p < 0 || p >= l / a)
|
|
1364
|
+
throw new Error(`Invalid indices: ${f} does not index into ${i}`);
|
|
1365
|
+
for (let I = 0; I < a; I++)
|
|
1366
|
+
u.values[h * a + I] = t.get(...t.indexToLoc(p * a + I));
|
|
1367
|
+
}
|
|
1368
|
+
return u;
|
|
1369
|
+
}
|
|
1370
|
+
/**
|
|
1371
|
+
* @license
|
|
1372
|
+
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
1373
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1374
|
+
* you may not use this file except in compliance with the License.
|
|
1375
|
+
* You may obtain a copy of the License at
|
|
1376
|
+
*
|
|
1377
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1378
|
+
*
|
|
1379
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1380
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1381
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1382
|
+
* See the License for the specific language governing permissions and
|
|
1383
|
+
* limitations under the License.
|
|
1384
|
+
* =============================================================================
|
|
1385
|
+
*/
|
|
1386
|
+
function Kn(e, t, n) {
|
|
1387
|
+
const s = H(n, e.dtype);
|
|
1388
|
+
for (let o = 0; o < s.size; ++o) {
|
|
1389
|
+
const r = s.indexToLoc(o).slice(), i = r[0], l = r[2], u = t.locToIndex([i, l]);
|
|
1390
|
+
r[2] = t.values[u];
|
|
1391
|
+
const h = e.locToIndex(r);
|
|
1392
|
+
0 <= h && h < e.values.length && (s.values[o] = e.values[h]);
|
|
1393
|
+
}
|
|
1394
|
+
return s;
|
|
1395
|
+
}
|
|
1396
|
+
/**
|
|
1397
|
+
* @license
|
|
1398
|
+
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
1399
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1400
|
+
* you may not use this file except in compliance with the License.
|
|
1401
|
+
* You may obtain a copy of the License at
|
|
1402
|
+
*
|
|
1403
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1404
|
+
*
|
|
1405
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1406
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1407
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1408
|
+
* See the License for the specific language governing permissions and
|
|
1409
|
+
* limitations under the License.
|
|
1410
|
+
* =============================================================================
|
|
1411
|
+
*/
|
|
1412
|
+
const xe = W((e, t) => e > t ? 1 : 0), Xn = z($t, xe, null, "bool"), uo = {
|
|
1413
|
+
kernelName: $t,
|
|
1414
|
+
backendName: "cpu",
|
|
1415
|
+
kernelFunc: Xn
|
|
1416
|
+
};
|
|
1417
|
+
/**
|
|
1418
|
+
* @license
|
|
1419
|
+
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
1420
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1421
|
+
* you may not use this file except in compliance with the License.
|
|
1422
|
+
* You may obtain a copy of the License at
|
|
1423
|
+
*
|
|
1424
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1425
|
+
*
|
|
1426
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1427
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1428
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1429
|
+
* See the License for the specific language governing permissions and
|
|
1430
|
+
* limitations under the License.
|
|
1431
|
+
* =============================================================================
|
|
1432
|
+
*/
|
|
1433
|
+
const Ee = W((e, t) => e >= t ? 1 : 0), Yn = z(zt, Ee, null, "bool"), ho = {
|
|
1434
|
+
kernelName: zt,
|
|
1435
|
+
backendName: "cpu",
|
|
1436
|
+
kernelFunc: Yn
|
|
1437
|
+
};
|
|
1438
|
+
/**
|
|
1439
|
+
* @license
|
|
1440
|
+
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
1441
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1442
|
+
* you may not use this file except in compliance with the License.
|
|
1443
|
+
* You may obtain a copy of the License at
|
|
1444
|
+
*
|
|
1445
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1446
|
+
*
|
|
1447
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1448
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1449
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1450
|
+
* See the License for the specific language governing permissions and
|
|
1451
|
+
* limitations under the License.
|
|
1452
|
+
* =============================================================================
|
|
1453
|
+
*/
|
|
1454
|
+
const Fe = W((e, t) => e < t ? 1 : 0), Jn = z(Bt, Fe, null, "bool"), fo = {
|
|
1455
|
+
kernelName: Bt,
|
|
1456
|
+
backendName: "cpu",
|
|
1457
|
+
kernelFunc: Jn
|
|
1458
|
+
};
|
|
1459
|
+
/**
|
|
1460
|
+
* @license
|
|
1461
|
+
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
1462
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1463
|
+
* you may not use this file except in compliance with the License.
|
|
1464
|
+
* You may obtain a copy of the License at
|
|
1465
|
+
*
|
|
1466
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1467
|
+
*
|
|
1468
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1469
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1470
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1471
|
+
* See the License for the specific language governing permissions and
|
|
1472
|
+
* limitations under the License.
|
|
1473
|
+
* =============================================================================
|
|
1474
|
+
*/
|
|
1475
|
+
const ye = W((e, t) => e <= t ? 1 : 0), Qn = z(Gt, ye, null, "bool"), go = {
|
|
1476
|
+
kernelName: Gt,
|
|
1477
|
+
backendName: "cpu",
|
|
1478
|
+
kernelFunc: Qn
|
|
1479
|
+
};
|
|
1480
|
+
/**
|
|
1481
|
+
* @license
|
|
1482
|
+
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
1483
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1484
|
+
* you may not use this file except in compliance with the License.
|
|
1485
|
+
* You may obtain a copy of the License at
|
|
1486
|
+
*
|
|
1487
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1488
|
+
*
|
|
1489
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1490
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1491
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1492
|
+
* See the License for the specific language governing permissions and
|
|
1493
|
+
* limitations under the License.
|
|
1494
|
+
* =============================================================================
|
|
1495
|
+
*/
|
|
1496
|
+
function ts(e, t, n) {
|
|
1497
|
+
const s = (t - e) / (n - 1), o = st(n, "float32");
|
|
1498
|
+
o[0] = e;
|
|
1499
|
+
for (let a = 1; a < o.length; a++)
|
|
1500
|
+
o[a] = o[a - 1] + s;
|
|
1501
|
+
return o;
|
|
1502
|
+
}
|
|
1503
|
+
/**
|
|
1504
|
+
* @license
|
|
1505
|
+
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
1506
|
+
* Licensed under the Apache License, Version 2.0 (the License);
|
|
1507
|
+
* you may not use this file except in compliance with the License.
|
|
1508
|
+
* You may obtain a copy of the License at
|
|
1509
|
+
*
|
|
1510
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1511
|
+
*
|
|
1512
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1513
|
+
* distributed under the License is distributed on an AS IS BASIS,
|
|
1514
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1515
|
+
* See the License for the specific language governing permissions and
|
|
1516
|
+
* limitations under the License.
|
|
1517
|
+
* =============================================================================
|
|
1518
|
+
*/
|
|
1519
|
+
const ke = X((e) => Math.log(e)), es = J(jt, ke), mo = {
|
|
1520
|
+
kernelName: jt,
|
|
1521
|
+
backendName: "cpu",
|
|
1522
|
+
kernelFunc: es
|
|
1523
|
+
};
|
|
1524
|
+
/**
|
|
1525
|
+
* @license
|
|
1526
|
+
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
1527
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1528
|
+
* you may not use this file except in compliance with the License.
|
|
1529
|
+
* You may obtain a copy of the License at
|
|
1530
|
+
*
|
|
1531
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1532
|
+
*
|
|
1533
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1534
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1535
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1536
|
+
* See the License for the specific language governing permissions and
|
|
1537
|
+
* limitations under the License.
|
|
1538
|
+
* =============================================================================
|
|
1539
|
+
*/
|
|
1540
|
+
function ns(e, t, n, s) {
|
|
1541
|
+
const o = et(s, A(n));
|
|
1542
|
+
for (let a = 0; a < o.length; ++a) {
|
|
1543
|
+
const r = a * t;
|
|
1544
|
+
let i = e[r];
|
|
1545
|
+
for (let l = 0; l < t; ++l) {
|
|
1546
|
+
const u = e[r + l];
|
|
1547
|
+
(Number.isNaN(u) || u > i) && (i = u);
|
|
1548
|
+
}
|
|
1549
|
+
o[a] = i;
|
|
1550
|
+
}
|
|
1551
|
+
return o;
|
|
1552
|
+
}
|
|
1553
|
+
/**
|
|
1554
|
+
* @license
|
|
1555
|
+
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
1556
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1557
|
+
* you may not use this file except in compliance with the License.
|
|
1558
|
+
* You may obtain a copy of the License at
|
|
1559
|
+
*
|
|
1560
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1561
|
+
*
|
|
1562
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1563
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1564
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1565
|
+
* See the License for the specific language governing permissions and
|
|
1566
|
+
* limitations under the License.
|
|
1567
|
+
* =============================================================================
|
|
1568
|
+
*/
|
|
1569
|
+
const Ne = W((e, t) => Math.max(e, t)), ss = z(Zt, Ne), po = {
|
|
1570
|
+
kernelName: Zt,
|
|
1571
|
+
backendName: "cpu",
|
|
1572
|
+
kernelFunc: ss
|
|
1573
|
+
};
|
|
1574
|
+
/**
|
|
1575
|
+
* @license
|
|
1576
|
+
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
1577
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1578
|
+
* you may not use this file except in compliance with the License.
|
|
1579
|
+
* You may obtain a copy of the License at
|
|
1580
|
+
*
|
|
1581
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1582
|
+
*
|
|
1583
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1584
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1585
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1586
|
+
* See the License for the specific language governing permissions and
|
|
1587
|
+
* limitations under the License.
|
|
1588
|
+
* =============================================================================
|
|
1589
|
+
*/
|
|
1590
|
+
const Se = W((e, t) => Math.min(e, t)), os = z(Ht, Se), Io = {
|
|
1591
|
+
kernelName: Ht,
|
|
1592
|
+
backendName: "cpu",
|
|
1593
|
+
kernelFunc: os
|
|
1594
|
+
};
|
|
1595
|
+
/**
|
|
1596
|
+
* @license
|
|
1597
|
+
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
1598
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1599
|
+
* you may not use this file except in compliance with the License.
|
|
1600
|
+
* You may obtain a copy of the License at
|
|
1601
|
+
*
|
|
1602
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1603
|
+
*
|
|
1604
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1605
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1606
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1607
|
+
* See the License for the specific language governing permissions and
|
|
1608
|
+
* limitations under the License.
|
|
1609
|
+
* =============================================================================
|
|
1610
|
+
*/
|
|
1611
|
+
const yt = W((e, t) => e * t), rs = Ft((e, t, n, s) => ({
|
|
1612
|
+
real: e * n - t * s,
|
|
1613
|
+
imag: e * s + t * n
|
|
1614
|
+
})), as = z(Kt, yt, rs), wo = {
|
|
1615
|
+
kernelName: Kt,
|
|
1616
|
+
backendName: "cpu",
|
|
1617
|
+
kernelFunc: as
|
|
1618
|
+
};
|
|
1619
|
+
/**
|
|
1620
|
+
* @license
|
|
1621
|
+
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
1622
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1623
|
+
* you may not use this file except in compliance with the License.
|
|
1624
|
+
* You may obtain a copy of the License at
|
|
1625
|
+
*
|
|
1626
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1627
|
+
*
|
|
1628
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1629
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1630
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1631
|
+
* See the License for the specific language governing permissions and
|
|
1632
|
+
* limitations under the License.
|
|
1633
|
+
* =============================================================================
|
|
1634
|
+
*/
|
|
1635
|
+
function ve(e, t, n) {
|
|
1636
|
+
const s = je(-1, n);
|
|
1637
|
+
return yt([], t, s, e, n);
|
|
1638
|
+
}
|
|
1639
|
+
function is(e) {
|
|
1640
|
+
const { inputs: t, backend: n } = e, { x: s } = t;
|
|
1641
|
+
nt(s, "neg");
|
|
1642
|
+
const o = n.data.get(s.dataId).values, [a, r] = ve(o, s.shape, s.dtype);
|
|
1643
|
+
return n.makeTensorInfo(r, s.dtype, a);
|
|
1644
|
+
}
|
|
1645
|
+
const bo = {
|
|
1646
|
+
kernelName: Ge,
|
|
1647
|
+
backendName: "cpu",
|
|
1648
|
+
kernelFunc: is
|
|
1649
|
+
};
|
|
1650
|
+
/**
|
|
1651
|
+
* @license
|
|
1652
|
+
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
1653
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1654
|
+
* you may not use this file except in compliance with the License.
|
|
1655
|
+
* You may obtain a copy of the License at
|
|
1656
|
+
*
|
|
1657
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1658
|
+
*
|
|
1659
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1660
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1661
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1662
|
+
* See the License for the specific language governing permissions and
|
|
1663
|
+
* limitations under the License.
|
|
1664
|
+
* =============================================================================
|
|
1665
|
+
*/
|
|
1666
|
+
const Te = W((e, t) => e !== t ? 1 : 0), ls = z(Xt, Te, null, "bool"), xo = {
|
|
1667
|
+
kernelName: Xt,
|
|
1668
|
+
backendName: "cpu",
|
|
1669
|
+
kernelFunc: ls
|
|
1670
|
+
};
|
|
1671
|
+
/**
|
|
1672
|
+
* @license
|
|
1673
|
+
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
1674
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1675
|
+
* you may not use this file except in compliance with the License.
|
|
1676
|
+
* You may obtain a copy of the License at
|
|
1677
|
+
*
|
|
1678
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1679
|
+
*
|
|
1680
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1681
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1682
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1683
|
+
* See the License for the specific language governing permissions and
|
|
1684
|
+
* limitations under the License.
|
|
1685
|
+
* =============================================================================
|
|
1686
|
+
*/
|
|
1687
|
+
function Re(e, t, n, s, o) {
|
|
1688
|
+
const a = t.length, r = A(t), i = K(t), l = K(o), u = et(n, A(o));
|
|
1689
|
+
for (let h = 0; h < r; ++h) {
|
|
1690
|
+
const f = gt(h, a, i), p = new Array(f.length);
|
|
1691
|
+
for (let m = 0; m < p.length; m++)
|
|
1692
|
+
p[m] = f[s[m]];
|
|
1693
|
+
const I = at(p, a, l);
|
|
1694
|
+
u[I] = e[h];
|
|
1695
|
+
}
|
|
1696
|
+
return u;
|
|
1697
|
+
}
|
|
1698
|
+
/**
|
|
1699
|
+
* @license
|
|
1700
|
+
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
1701
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1702
|
+
* you may not use this file except in compliance with the License.
|
|
1703
|
+
* You may obtain a copy of the License at
|
|
1704
|
+
*
|
|
1705
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1706
|
+
*
|
|
1707
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1708
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1709
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1710
|
+
* See the License for the specific language governing permissions and
|
|
1711
|
+
* limitations under the License.
|
|
1712
|
+
* =============================================================================
|
|
1713
|
+
*/
|
|
1714
|
+
function Pe(e) {
|
|
1715
|
+
const { inputs: t, attrs: n, backend: s } = e, { x: o } = t, { perm: a } = n;
|
|
1716
|
+
nt(o, "transpose");
|
|
1717
|
+
const r = o.shape.length, i = new Array(r);
|
|
1718
|
+
for (let f = 0; f < i.length; f++)
|
|
1719
|
+
i[f] = o.shape[a[f]];
|
|
1720
|
+
const l = s.data.get(o.dataId).values, u = Re(l, o.shape, o.dtype, a, i);
|
|
1721
|
+
return { dataId: s.write(u, i, o.dtype), shape: i, dtype: o.dtype };
|
|
1722
|
+
}
|
|
1723
|
+
const Eo = {
|
|
1724
|
+
kernelName: Ze,
|
|
1725
|
+
backendName: "cpu",
|
|
1726
|
+
kernelFunc: Pe
|
|
1727
|
+
};
|
|
1728
|
+
/**
|
|
1729
|
+
* @license
|
|
1730
|
+
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
1731
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1732
|
+
* you may not use this file except in compliance with the License.
|
|
1733
|
+
* You may obtain a copy of the License at
|
|
1734
|
+
*
|
|
1735
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1736
|
+
*
|
|
1737
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1738
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1739
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1740
|
+
* See the License for the specific language governing permissions and
|
|
1741
|
+
* limitations under the License.
|
|
1742
|
+
* =============================================================================
|
|
1743
|
+
*/
|
|
1744
|
+
function Ce(e, t, n, s) {
|
|
1745
|
+
const [o, a] = bn(e, s), r = Ke(t, "int32"), i = st(A(o), r), l = A(a);
|
|
1746
|
+
for (let u = 0; u < i.length; ++u) {
|
|
1747
|
+
const h = u * l;
|
|
1748
|
+
let f = 1;
|
|
1749
|
+
for (let p = 0; p < l; ++p)
|
|
1750
|
+
f *= n[h + p];
|
|
1751
|
+
i[u] = f;
|
|
1752
|
+
}
|
|
1753
|
+
return { outVals: i, outShape: o, outDtype: r };
|
|
1754
|
+
}
|
|
1755
|
+
function cs(e) {
|
|
1756
|
+
const { inputs: t, backend: n, attrs: s } = e, { x: o } = t, { axis: a, keepDims: r } = s;
|
|
1757
|
+
nt(o, "prod");
|
|
1758
|
+
const i = o.shape.length, l = Yt(a, o.shape), u = pn(l, i);
|
|
1759
|
+
let h = l, f = o;
|
|
1760
|
+
const p = [];
|
|
1761
|
+
u != null && (f = Pe({ inputs: { x: o }, backend: n, attrs: { perm: u } }), p.push(f), h = In(h.length, i));
|
|
1762
|
+
const I = n.data.get(f.dataId).values, { outVals: m, outShape: F, outDtype: g } = Ce(f.shape, f.dtype, I, h);
|
|
1763
|
+
let d = F;
|
|
1764
|
+
return r && (d = wn(F, l)), p.forEach((b) => n.disposeIntermediateTensorInfo(b)), n.makeTensorInfo(d, g, m);
|
|
1765
|
+
}
|
|
1766
|
+
const Fo = {
|
|
1767
|
+
kernelName: He,
|
|
1768
|
+
backendName: "cpu",
|
|
1769
|
+
kernelFunc: cs
|
|
1770
|
+
};
|
|
1771
|
+
/**
|
|
1772
|
+
* @license
|
|
1773
|
+
* Copyright 2022 Google LLC. All Rights Reserved.
|
|
1774
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1775
|
+
* you may not use this file except in compliance with the License.
|
|
1776
|
+
* You may obtain a copy of the License at
|
|
1777
|
+
*
|
|
1778
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1779
|
+
*
|
|
1780
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1781
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1782
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1783
|
+
* See the License for the specific language governing permissions and
|
|
1784
|
+
* limitations under the License.
|
|
1785
|
+
* =============================================================================
|
|
1786
|
+
*/
|
|
1787
|
+
function us(e, t, n) {
|
|
1788
|
+
e.forEach((s, o) => {
|
|
1789
|
+
if (s < 0 || s >= n) {
|
|
1790
|
+
const a = gt(o, t.length, K(t)).join(",");
|
|
1791
|
+
throw new Error(`indices[${a}] = ${s} is not in [0, ${n})`);
|
|
1792
|
+
}
|
|
1793
|
+
});
|
|
1794
|
+
}
|
|
1795
|
+
function hs(e, t) {
|
|
1796
|
+
for (let n = 0; n < e.length; ++n) {
|
|
1797
|
+
const s = e[n], o = n === e.length - 1 ? t : e[n + 1].length;
|
|
1798
|
+
if (s.length === 0)
|
|
1799
|
+
throw new Error("Ragged splits may not be empty");
|
|
1800
|
+
if (s[0] < 0)
|
|
1801
|
+
throw new Error("Ragged splits must be non-negative");
|
|
1802
|
+
if (s[s.length - 1] > o)
|
|
1803
|
+
throw new Error("Ragged splits must not point past values");
|
|
1804
|
+
for (let a = 1; a < s.length; ++a)
|
|
1805
|
+
if (s[a - 1] > s[a])
|
|
1806
|
+
throw new Error("Ragged splits must be sorted in ascending order");
|
|
1807
|
+
}
|
|
1808
|
+
}
|
|
1809
|
+
function fs(e, t, n, s) {
|
|
1810
|
+
const o = [];
|
|
1811
|
+
let a = 0;
|
|
1812
|
+
const r = t.length - 1 + n.length, i = new Array(r).fill(null).map(() => [0]);
|
|
1813
|
+
hs(n, s);
|
|
1814
|
+
let l = 1;
|
|
1815
|
+
for (let u = 0; u < t.length - 1; ++u) {
|
|
1816
|
+
l *= t[u];
|
|
1817
|
+
const h = t[u + 1];
|
|
1818
|
+
for (let f = 1; f < l + 1; ++f)
|
|
1819
|
+
i[u].push(f * h);
|
|
1820
|
+
}
|
|
1821
|
+
for (let u = 0; u < e.length; ++u) {
|
|
1822
|
+
let h = e[u], f = e[u] + 1;
|
|
1823
|
+
for (let p = 0; p < n.length; ++p) {
|
|
1824
|
+
const I = n[p], m = p + t.length - 1;
|
|
1825
|
+
if (m >= 0) {
|
|
1826
|
+
const F = i[m], g = F[F.length - 1] - I[h];
|
|
1827
|
+
for (let d = h; d < f; ++d)
|
|
1828
|
+
i[m].push(I[d + 1] + g);
|
|
1829
|
+
}
|
|
1830
|
+
h = I[h], f = I[f];
|
|
1831
|
+
}
|
|
1832
|
+
f !== h && (o.push([h, f]), a += f - h);
|
|
1833
|
+
}
|
|
1834
|
+
return { outSplits: i, valueSlices: o, numValues: a };
|
|
1835
|
+
}
|
|
1836
|
+
function gs(e) {
|
|
1837
|
+
const t = [];
|
|
1838
|
+
for (let n = 0; n < e.length; ++n) {
|
|
1839
|
+
const s = e[n].length, o = D("int32", s);
|
|
1840
|
+
t.push(o), e[n].forEach((a, r) => o[r] = a);
|
|
1841
|
+
}
|
|
1842
|
+
return t;
|
|
1843
|
+
}
|
|
1844
|
+
function Tt(e, t) {
|
|
1845
|
+
const n = e.slice(0, t);
|
|
1846
|
+
for (; n.length < t; )
|
|
1847
|
+
n.push(1);
|
|
1848
|
+
for (let s = t; s < e.length; s++)
|
|
1849
|
+
n[t - 1] *= e[s];
|
|
1850
|
+
return n;
|
|
1851
|
+
}
|
|
1852
|
+
function ds(e, t, n, s, o, a) {
|
|
1853
|
+
const r = Tt(t, 2)[1], i = Tt(a, 2)[1];
|
|
1854
|
+
let l = 0;
|
|
1855
|
+
for (const u of n)
|
|
1856
|
+
for (let h = u[0]; h < u[1]; ++h) {
|
|
1857
|
+
for (let f = 0; f < s; ++f)
|
|
1858
|
+
o[l * i + f] = e[h * r + f];
|
|
1859
|
+
++l;
|
|
1860
|
+
}
|
|
1861
|
+
}
|
|
1862
|
+
function ms(e, t, n, s, o) {
|
|
1863
|
+
const a = t.slice();
|
|
1864
|
+
a[0] = o;
|
|
1865
|
+
const r = D(n, A(a)), i = e.length, l = i === 0 ? 0 : i / t[0];
|
|
1866
|
+
return ds(e, t, s, l, r, a), [r, a];
|
|
1867
|
+
}
|
|
1868
|
+
function ps(e, t, n, s, o, a, r, i) {
|
|
1869
|
+
if (e.length === 0)
|
|
1870
|
+
throw new Error("paramsNestedSplits must be non empty");
|
|
1871
|
+
if (t[0].length === 0)
|
|
1872
|
+
throw new Error("Split tensors must not be scalars");
|
|
1873
|
+
const l = t[0][0] - 1;
|
|
1874
|
+
if (us(a, r, l), s.length === 0)
|
|
1875
|
+
throw new Error("params.rank must be nonzero");
|
|
1876
|
+
const u = s[0], { outSplits: h, valueSlices: f, numValues: p } = fs(a, r, e, u), I = gs(h), m = ms(n, s, o, f, p);
|
|
1877
|
+
return [I, m[0], m[1]];
|
|
1878
|
+
}
|
|
1879
|
+
/**
|
|
1880
|
+
* @license
|
|
1881
|
+
* Copyright 2022 Google LLC.
|
|
1882
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1883
|
+
* you may not use this file except in compliance with the License.
|
|
1884
|
+
* You may obtain a copy of the License at
|
|
1885
|
+
*
|
|
1886
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1887
|
+
*
|
|
1888
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1889
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1890
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1891
|
+
* See the License for the specific language governing permissions and
|
|
1892
|
+
* limitations under the License.
|
|
1893
|
+
* =============================================================================
|
|
1894
|
+
*/
|
|
1895
|
+
const Rt = 2147483647;
|
|
1896
|
+
function Is(e, t, n, s, o, a, r) {
|
|
1897
|
+
if (t.length > 1)
|
|
1898
|
+
throw new Error("starts must be a scalar or vector");
|
|
1899
|
+
if (o.length > 1)
|
|
1900
|
+
throw new Error("limits must be a scalar or vector");
|
|
1901
|
+
if (r.length > 1)
|
|
1902
|
+
throw new Error("deltas must be a scalar or vector");
|
|
1903
|
+
const i = t.length === 0, l = o.length === 0, u = r.length === 0, h = [];
|
|
1904
|
+
i || h.push(t[0]), l || h.push(o[0]), u || h.push(r[0]);
|
|
1905
|
+
for (let g = 1; g < h.length; ++g)
|
|
1906
|
+
if (h[g] !== h[g - 1])
|
|
1907
|
+
throw new Error("starts, limits, and deltas must have the same shape");
|
|
1908
|
+
const f = h.length === 0 ? 1 : h[0], p = D("int32", f + 1);
|
|
1909
|
+
p[0] = 0;
|
|
1910
|
+
for (let g = 0; g < f; ++g) {
|
|
1911
|
+
const d = i ? e[0] : e[g], b = l ? s[0] : s[g], k = u ? a[0] : a[g];
|
|
1912
|
+
if (k === 0)
|
|
1913
|
+
throw new Error("Requires delta != 0");
|
|
1914
|
+
let y;
|
|
1915
|
+
if (k > 0 && b < d || k < 0 && b > d)
|
|
1916
|
+
y = 0;
|
|
1917
|
+
else if (y = Math.ceil(Math.abs((b - d) / k)), y > Rt)
|
|
1918
|
+
throw new Error(`Requires ((limit - start) / delta) <= ${Rt}`);
|
|
1919
|
+
p[g + 1] = p[g] + y;
|
|
1920
|
+
}
|
|
1921
|
+
const I = p[f], m = D(n, I);
|
|
1922
|
+
let F = 0;
|
|
1923
|
+
for (let g = 0; g < f; ++g) {
|
|
1924
|
+
const d = p[g + 1] - p[g];
|
|
1925
|
+
let b = i ? e[0] : e[g];
|
|
1926
|
+
const k = u ? a[0] : a[g];
|
|
1927
|
+
for (let y = 0; y < d; ++y)
|
|
1928
|
+
m[F++] = b, b += k;
|
|
1929
|
+
}
|
|
1930
|
+
return [p, m];
|
|
1931
|
+
}
|
|
1932
|
+
/**
|
|
1933
|
+
* @license
|
|
1934
|
+
* Copyright 2022 Google LLC. All Rights Reserved.
|
|
1935
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1936
|
+
* you may not use this file except in compliance with the License.
|
|
1937
|
+
* You may obtain a copy of the License at
|
|
1938
|
+
*
|
|
1939
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1940
|
+
*
|
|
1941
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1942
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1943
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1944
|
+
* See the License for the specific language governing permissions and
|
|
1945
|
+
* limitations under the License.
|
|
1946
|
+
* =============================================================================
|
|
1947
|
+
*/
|
|
1948
|
+
var Z = tn;
|
|
1949
|
+
class ft {
|
|
1950
|
+
constructor(t, n, s, o, a, r, i, l, u, h) {
|
|
1951
|
+
this.shape = t, this.shapeShape = n, this.values = s, this.valuesShape = o, this.valuesDType = a, this.defaultValue = r, this.defaultValueShape = i, this.rowPartitionValues = l, this.rowPartitionValuesShapes = u, this.rowPartitionTypes = Je(h), this.raggedRank = Qe(this.rowPartitionTypes);
|
|
1952
|
+
}
|
|
1953
|
+
getRowPartitionTypeByDimension(t) {
|
|
1954
|
+
return this.rowPartitionTypes[0] === Z.FIRST_DIM_SIZE ? this.rowPartitionTypes[t + 1] : this.rowPartitionTypes[t];
|
|
1955
|
+
}
|
|
1956
|
+
// Returns the relationship between dimension and dimension + 1.
|
|
1957
|
+
getRowPartitionTensor(t) {
|
|
1958
|
+
return this.rowPartitionTypes[0] === Z.FIRST_DIM_SIZE ? this.rowPartitionValues[t + 1] : this.rowPartitionValues[t];
|
|
1959
|
+
}
|
|
1960
|
+
getMaxWidth(t) {
|
|
1961
|
+
const n = this.getRowPartitionTensor(t - 1);
|
|
1962
|
+
switch (this.getRowPartitionTypeByDimension(t - 1)) {
|
|
1963
|
+
case Z.VALUE_ROWIDS:
|
|
1964
|
+
return ft.getMaxWidthValueRowID(n);
|
|
1965
|
+
case Z.ROW_SPLITS:
|
|
1966
|
+
return ft.getMaxWidthRowSplit(n);
|
|
1967
|
+
default:
|
|
1968
|
+
throw new Error(`Cannot handle partition type ${Z[this.getRowPartitionTypeByDimension(t - 1)]}`);
|
|
1969
|
+
}
|
|
1970
|
+
}
|
|
1971
|
+
static getMaxWidthRowSplit(t) {
|
|
1972
|
+
const n = t.length;
|
|
1973
|
+
if (n === 0 || n === 1)
|
|
1974
|
+
return 0;
|
|
1975
|
+
let s = 0;
|
|
1976
|
+
for (let o = 0; o < n - 1; ++o) {
|
|
1977
|
+
const a = t[o + 1] - t[o];
|
|
1978
|
+
a > s && (s = a);
|
|
1979
|
+
}
|
|
1980
|
+
return s;
|
|
1981
|
+
}
|
|
1982
|
+
static getMaxWidthValueRowID(t) {
|
|
1983
|
+
const n = t.length;
|
|
1984
|
+
if (n === 0)
|
|
1985
|
+
return 0;
|
|
1986
|
+
let s = 0, o = t[0], a = 0;
|
|
1987
|
+
for (let r = 1; r < n; ++r) {
|
|
1988
|
+
const i = t[r];
|
|
1989
|
+
i !== o && (o = i, a = Math.max(r - s, a), s = r);
|
|
1990
|
+
}
|
|
1991
|
+
return Math.max(n - s, a);
|
|
1992
|
+
}
|
|
1993
|
+
tensorShapeFromTensor(t, n, s = !0) {
|
|
1994
|
+
if (n.length === 0) {
|
|
1995
|
+
if (t[0] === -1)
|
|
1996
|
+
return [];
|
|
1997
|
+
throw new Error("The only valid scalar shape tensor is the fully unknown shape specified as -1.");
|
|
1998
|
+
}
|
|
1999
|
+
return Ct(t, s);
|
|
2000
|
+
}
|
|
2001
|
+
calculateOutputSize(t) {
|
|
2002
|
+
const n = this.valuesShape, s = this.defaultValueShape;
|
|
2003
|
+
en(s, n);
|
|
2004
|
+
const o = this.tensorShapeFromTensor(this.shape, this.shapeShape), r = nn(this.raggedRank, o, n);
|
|
2005
|
+
r[0] < 0 && (r[0] = t);
|
|
2006
|
+
for (let i = 1; i <= this.raggedRank; ++i)
|
|
2007
|
+
r[i] < 0 && (r[i] = this.getMaxWidth(i));
|
|
2008
|
+
return r;
|
|
2009
|
+
}
|
|
2010
|
+
/**
|
|
2011
|
+
* The outputIndex represents the index in the output tensor
|
|
2012
|
+
* where the first element of a particular dimension would be written.
|
|
2013
|
+
* If it is -1, it indicates that the index is out of scope.
|
|
2014
|
+
* Example, given firstDimension = 10, firstDimensionOutput = 6,
|
|
2015
|
+
* and outputIndexMultiplier = 100:
|
|
2016
|
+
* result = [0 100 200 300 400 500 -1 -1 -1 -1]
|
|
2017
|
+
* If firstDimensionOutput = 11 instead, then:
|
|
2018
|
+
* result = [0 100 200 300 400 500 600 700 800 900]
|
|
2019
|
+
*/
|
|
2020
|
+
calculateFirstParentOutputIndex(t, n, s) {
|
|
2021
|
+
const o = Math.min(t, s), a = [];
|
|
2022
|
+
let r = 0;
|
|
2023
|
+
for (let i = 0; i < o; ++i, r += n)
|
|
2024
|
+
a.push(r);
|
|
2025
|
+
for (let i = o; i < t; ++i)
|
|
2026
|
+
a.push(-1);
|
|
2027
|
+
return qt(a.length === t, () => "Final length of result must be equal to firstDimension."), a;
|
|
2028
|
+
}
|
|
2029
|
+
calculateOutputIndexRowSplit(t, n, s, o) {
|
|
2030
|
+
const a = t.length, r = [];
|
|
2031
|
+
for (let i = 0; i < a - 1; ++i) {
|
|
2032
|
+
const l = t[i + 1] - t[i];
|
|
2033
|
+
let u = Math.min(o, l), h = n[i];
|
|
2034
|
+
h === -1 && (u = 0);
|
|
2035
|
+
for (let f = 0; f < u; ++f)
|
|
2036
|
+
r.push(h), h += s;
|
|
2037
|
+
for (let f = 0; f < l - u; ++f)
|
|
2038
|
+
r.push(-1);
|
|
2039
|
+
}
|
|
2040
|
+
if (a > 0 && r.length !== t[a - 1])
|
|
2041
|
+
throw new Error("Invalid row split size.");
|
|
2042
|
+
return r;
|
|
2043
|
+
}
|
|
2044
|
+
// Calculate the output index of the first element of a list.
|
|
2045
|
+
// The parentOutputIndex is the same computation for the previous list.
|
|
2046
|
+
// -1 indicates an element or list that is out of range.
|
|
2047
|
+
// The outputIndexMultiplier is the number of output indices one moves
|
|
2048
|
+
// forward for each column.
|
|
2049
|
+
// E.g., given:
|
|
2050
|
+
// valueRowIds:[0 1 2 2 2 3 5 5 6]
|
|
2051
|
+
// parentOutputIndex:[1000 1100 2000 2100 -1 3000 4000]
|
|
2052
|
+
// outputIndexMultiplier: 10
|
|
2053
|
+
// outputSize: 2
|
|
2054
|
+
// You get:
|
|
2055
|
+
// result = [1000 1100 2000 2010 -1 2100 -1 -1 3000]
|
|
2056
|
+
// result[0] = parentOutputIndex[valueRowIds[0]]
|
|
2057
|
+
// result[1] = parentOutputIndex[valueRowIds[1]]
|
|
2058
|
+
// result[2] = parentOutputIndex[valueRowIds[2]]
|
|
2059
|
+
// result[3] = parentOutputIndex[valueRowIds[2] + 10]
|
|
2060
|
+
// result[4] = -1 because it is the third element the size is 2.
|
|
2061
|
+
// result[5] = parentOutputIndex[valueRowIds[3]]
|
|
2062
|
+
// result[6] = -1 because parentOutputIndex[valueRowIds[6]] == -1
|
|
2063
|
+
// result[7] = -1 because parentOutputIndex[valueRowIds[6]] == -1
|
|
2064
|
+
// result[8] = parentOutputIndex[valueRowIds[7]]
|
|
2065
|
+
calculateOutputIndexValueRowID(t, n, s, o) {
|
|
2066
|
+
const a = t.length, r = [];
|
|
2067
|
+
if (a === 0)
|
|
2068
|
+
return [];
|
|
2069
|
+
let i = 0, l = t[0];
|
|
2070
|
+
if (l >= n.length)
|
|
2071
|
+
throw new Error(`Got currentValueRowId=${l}, which is not less than ${n.length}`);
|
|
2072
|
+
let u = n[l];
|
|
2073
|
+
r.push(u);
|
|
2074
|
+
for (let h = 1; h < a; ++h) {
|
|
2075
|
+
const f = t[h];
|
|
2076
|
+
if (f === l)
|
|
2077
|
+
u >= 0 && (++i, i < o ? u += s : u = -1);
|
|
2078
|
+
else {
|
|
2079
|
+
if (i = 0, l = f, f >= n.length)
|
|
2080
|
+
throw new Error(`Got nextValueRowId=${f} which is not less than ${n.length}`);
|
|
2081
|
+
u = n[f];
|
|
2082
|
+
}
|
|
2083
|
+
r.push(u);
|
|
2084
|
+
}
|
|
2085
|
+
if (r.length !== t.length)
|
|
2086
|
+
throw new Error("Invalid row ids.");
|
|
2087
|
+
return r;
|
|
2088
|
+
}
|
|
2089
|
+
calculateOutputIndex(t, n, s, o) {
|
|
2090
|
+
const a = this.getRowPartitionTensor(t), r = this.getRowPartitionTypeByDimension(t);
|
|
2091
|
+
switch (r) {
|
|
2092
|
+
case Z.VALUE_ROWIDS:
|
|
2093
|
+
return this.calculateOutputIndexValueRowID(a, n, s, o);
|
|
2094
|
+
case Z.ROW_SPLITS:
|
|
2095
|
+
if (a.length - 1 > n.length)
|
|
2096
|
+
throw new Error(`Row partition size is greater than output size: ${a.length - 1} > ${n.length}`);
|
|
2097
|
+
return this.calculateOutputIndexRowSplit(a, n, s, o);
|
|
2098
|
+
default:
|
|
2099
|
+
throw new Error(`Unsupported partition type: ${Z[r]}`);
|
|
2100
|
+
}
|
|
2101
|
+
}
|
|
2102
|
+
getFirstDimensionSize() {
|
|
2103
|
+
const t = this.rowPartitionValues[0];
|
|
2104
|
+
if (this.rowPartitionTypes.length === 0)
|
|
2105
|
+
throw new Error("No row_partition_types given.");
|
|
2106
|
+
const n = this.rowPartitionTypes[0];
|
|
2107
|
+
switch (n) {
|
|
2108
|
+
case Z.FIRST_DIM_SIZE:
|
|
2109
|
+
return t[0];
|
|
2110
|
+
case Z.VALUE_ROWIDS:
|
|
2111
|
+
throw new Error("Cannot handle VALUE_ROWIDS in first dimension.");
|
|
2112
|
+
case Z.ROW_SPLITS:
|
|
2113
|
+
return this.rowPartitionValuesShapes[0][0] - 1;
|
|
2114
|
+
default:
|
|
2115
|
+
throw new Error(`Cannot handle type ${Z[n]}`);
|
|
2116
|
+
}
|
|
2117
|
+
}
|
|
2118
|
+
compute() {
|
|
2119
|
+
if (this.rowPartitionValues[0].length <= 0)
|
|
2120
|
+
throw new Error("Invalid first partition input. Tensor requires at least one element.");
|
|
2121
|
+
const n = this.getFirstDimensionSize(), s = this.calculateOutputSize(n), o = new Array(this.raggedRank + 1);
|
|
2122
|
+
o[o.length - 1] = 1;
|
|
2123
|
+
for (let l = o.length - 2; l >= 0; --l)
|
|
2124
|
+
o[l] = o[l + 1] * s[l + 1];
|
|
2125
|
+
const a = Ct(s, !1), r = D(this.valuesDType, A(a));
|
|
2126
|
+
if (o[0] * s[0] > 0) {
|
|
2127
|
+
let l = this.calculateFirstParentOutputIndex(n, o[0], s[0]);
|
|
2128
|
+
for (let u = 1; u <= this.raggedRank; ++u)
|
|
2129
|
+
l = this.calculateOutputIndex(u - 1, l, o[u], s[u]);
|
|
2130
|
+
this.setOutput(this.raggedRank, l, r, a);
|
|
2131
|
+
}
|
|
2132
|
+
return [a, r];
|
|
2133
|
+
}
|
|
2134
|
+
setOutput(t, n, s, o) {
|
|
2135
|
+
if (s.length === 0)
|
|
2136
|
+
return;
|
|
2137
|
+
const a = this.values, r = s;
|
|
2138
|
+
let i = o.slice();
|
|
2139
|
+
i = i.slice(t + 1);
|
|
2140
|
+
const l = A(i), u = n.length;
|
|
2141
|
+
let h = this.defaultValue;
|
|
2142
|
+
if (h.length !== l && h.length !== 1) {
|
|
2143
|
+
const m = this.defaultValueShape;
|
|
2144
|
+
Xe(() => {
|
|
2145
|
+
const F = En(h, m);
|
|
2146
|
+
h = xn(F, i).dataSync();
|
|
2147
|
+
});
|
|
2148
|
+
}
|
|
2149
|
+
let f = 0, p = 0, I = 0;
|
|
2150
|
+
for (let m = 0; m <= u; ++m) {
|
|
2151
|
+
let F = m < u ? n[m] : -1;
|
|
2152
|
+
if (F === I) {
|
|
2153
|
+
++I;
|
|
2154
|
+
continue;
|
|
2155
|
+
}
|
|
2156
|
+
if (p < I) {
|
|
2157
|
+
const g = a.subarray(f * l), d = r.subarray(p * l), b = (I - p) * l;
|
|
2158
|
+
Pt(d, g, b);
|
|
2159
|
+
}
|
|
2160
|
+
if (m >= u) {
|
|
2161
|
+
const g = s.length;
|
|
2162
|
+
F = Math.floor(g / l);
|
|
2163
|
+
}
|
|
2164
|
+
if (F > I)
|
|
2165
|
+
if (this.defaultValue.length === 1)
|
|
2166
|
+
r.subarray(I * l, F * l).fill(this.defaultValue[0]), I = F;
|
|
2167
|
+
else
|
|
2168
|
+
for (; F > I; ) {
|
|
2169
|
+
const g = r.slice(I * l);
|
|
2170
|
+
Pt(g, h, l), ++I;
|
|
2171
|
+
}
|
|
2172
|
+
F < 0 ? (f = m + 1, p = I) : (f = m, p = I, I = p + 1);
|
|
2173
|
+
}
|
|
2174
|
+
}
|
|
2175
|
+
}
|
|
2176
|
+
function Pt(e, t, n) {
|
|
2177
|
+
for (let s = 0; s < n; s++)
|
|
2178
|
+
e[s] = t[s];
|
|
2179
|
+
}
|
|
2180
|
+
function Ct(e, t) {
|
|
2181
|
+
const n = [];
|
|
2182
|
+
for (let s of e) {
|
|
2183
|
+
if (s < 0) {
|
|
2184
|
+
if (!t)
|
|
2185
|
+
throw new Error(`Dimension ${s} must be >= 0`);
|
|
2186
|
+
if (s < -1)
|
|
2187
|
+
throw new Error(`Dimension ${s} must be >= -1`);
|
|
2188
|
+
s = -1;
|
|
2189
|
+
}
|
|
2190
|
+
n.push(s);
|
|
2191
|
+
}
|
|
2192
|
+
return n;
|
|
2193
|
+
}
|
|
2194
|
+
function ws(e, t, n, s, o, a, r, i, l, u) {
|
|
2195
|
+
return new ft(e, t, n, s, o, a, r, i, l, u).compute();
|
|
2196
|
+
}
|
|
2197
|
+
/**
|
|
2198
|
+
* @license
|
|
2199
|
+
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
2200
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2201
|
+
* you may not use this file except in compliance with the License.
|
|
2202
|
+
* You may obtain a copy of the License at
|
|
2203
|
+
*
|
|
2204
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2205
|
+
*
|
|
2206
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2207
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2208
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2209
|
+
* See the License for the specific language governing permissions and
|
|
2210
|
+
* limitations under the License.
|
|
2211
|
+
* =============================================================================
|
|
2212
|
+
*/
|
|
2213
|
+
function bs(e, t, n, s) {
|
|
2214
|
+
const o = e === t, a = e < t && n < 0, r = t < e && n > 1;
|
|
2215
|
+
if (o || a || r)
|
|
2216
|
+
return st(0, s);
|
|
2217
|
+
const i = Math.abs(Math.ceil((t - e) / n)), l = st(i, s);
|
|
2218
|
+
t < e && n === 1 && (n = -1), l[0] = e;
|
|
2219
|
+
for (let u = 1; u < l.length; u++)
|
|
2220
|
+
l[u] = l[u - 1] + n;
|
|
2221
|
+
return l;
|
|
2222
|
+
}
|
|
2223
|
+
/**
|
|
2224
|
+
* @license
|
|
2225
|
+
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
2226
|
+
* Licensed under the Apache License, Version 2.0 (the License);
|
|
2227
|
+
* you may not use this file except in compliance with the License.
|
|
2228
|
+
* You may obtain a copy of the License at
|
|
2229
|
+
*
|
|
2230
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2231
|
+
*
|
|
2232
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2233
|
+
* distributed under the License is distributed on an AS IS BASIS,
|
|
2234
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2235
|
+
* See the License for the specific language governing permissions and
|
|
2236
|
+
* limitations under the License.
|
|
2237
|
+
* =============================================================================
|
|
2238
|
+
*/
|
|
2239
|
+
const qe = X((e) => 1 / Math.sqrt(e)), xs = J(Jt, qe), yo = {
|
|
2240
|
+
kernelName: Jt,
|
|
2241
|
+
backendName: "cpu",
|
|
2242
|
+
kernelFunc: xs
|
|
2243
|
+
};
|
|
2244
|
+
/**
|
|
2245
|
+
* @license
|
|
2246
|
+
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
2247
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2248
|
+
* you may not use this file except in compliance with the License.
|
|
2249
|
+
* You may obtain a copy of the License at
|
|
2250
|
+
*
|
|
2251
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2252
|
+
*
|
|
2253
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2254
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2255
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2256
|
+
* See the License for the specific language governing permissions and
|
|
2257
|
+
* limitations under the License.
|
|
2258
|
+
* =============================================================================
|
|
2259
|
+
*/
|
|
2260
|
+
function Es(e, t, n, s, o, a, r, i, l, u) {
|
|
2261
|
+
const h = [s / o, o], f = e.values, p = t.values;
|
|
2262
|
+
if (s === 0)
|
|
2263
|
+
return H(n, t.dtype);
|
|
2264
|
+
const I = l instanceof wt ? l : H(h, t.dtype);
|
|
2265
|
+
typeof l == "string" || typeof l == "number" ? I.values.fill(l) : typeof l == "boolean" && I.values.fill(+l);
|
|
2266
|
+
for (let m = 0; m < a; m++) {
|
|
2267
|
+
const F = [];
|
|
2268
|
+
let g = 0;
|
|
2269
|
+
for (let d = 0; d < r; d++) {
|
|
2270
|
+
const b = f[m * r + d];
|
|
2271
|
+
F.push(b), g += b * i[d];
|
|
2272
|
+
}
|
|
2273
|
+
if (g < 0 || g >= s / o)
|
|
2274
|
+
throw new Error(`Invalid indices: ${F} does not index into ${n}`);
|
|
2275
|
+
for (let d = 0; d < o; d++)
|
|
2276
|
+
u ? I.values[g * o + d] += p[m * o + d] : I.values[g * o + d] = t.rank === 0 ? p[0] : p[m * o + d];
|
|
2277
|
+
}
|
|
2278
|
+
return I;
|
|
2279
|
+
}
|
|
2280
|
+
/**
|
|
2281
|
+
* @license
|
|
2282
|
+
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
2283
|
+
* Licensed under the Apache License, Version 2.0 (the License);
|
|
2284
|
+
* you may not use this file except in compliance with the License.
|
|
2285
|
+
* You may obtain a copy of the License at
|
|
2286
|
+
*
|
|
2287
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2288
|
+
*
|
|
2289
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2290
|
+
* distributed under the License is distributed on an AS IS BASIS,
|
|
2291
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2292
|
+
* See the License for the specific language governing permissions and
|
|
2293
|
+
* limitations under the License.
|
|
2294
|
+
* =============================================================================
|
|
2295
|
+
*/
|
|
2296
|
+
const Fs = X((e) => 1 / (1 + Math.exp(-e))), ys = ge(Qt, (e) => 1 / (1 + Math.exp(-e))), ko = {
|
|
2297
|
+
kernelName: Qt,
|
|
2298
|
+
backendName: "cpu",
|
|
2299
|
+
kernelFunc: ys
|
|
2300
|
+
};
|
|
2301
|
+
/**
|
|
2302
|
+
* @license
|
|
2303
|
+
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
2304
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2305
|
+
* you may not use this file except in compliance with the License.
|
|
2306
|
+
* You may obtain a copy of the License at
|
|
2307
|
+
*
|
|
2308
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2309
|
+
*
|
|
2310
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2311
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2312
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2313
|
+
* See the License for the specific language governing permissions and
|
|
2314
|
+
* limitations under the License.
|
|
2315
|
+
* =============================================================================
|
|
2316
|
+
*/
|
|
2317
|
+
function Ue(e, t, n, s, o) {
|
|
2318
|
+
const a = kn(s, t, n), r = A(n), i = K(s);
|
|
2319
|
+
if (a) {
|
|
2320
|
+
const f = Nn(t, i);
|
|
2321
|
+
return o === "string" ? e.slice(f, f + r) : e.subarray(f, f + r);
|
|
2322
|
+
}
|
|
2323
|
+
const l = o === "string" ? it(e) : e, u = H(s, o, l), h = H(n, o);
|
|
2324
|
+
for (let f = 0; f < h.size; ++f) {
|
|
2325
|
+
const p = h.indexToLoc(f), I = p.map((m, F) => m + t[F]);
|
|
2326
|
+
h.set(u.get(...I), ...p);
|
|
2327
|
+
}
|
|
2328
|
+
return o === "string" ? sn(h.values) : h.values;
|
|
2329
|
+
}
|
|
2330
|
+
function ks(e) {
|
|
2331
|
+
const { inputs: t, backend: n, attrs: s } = e, { x: o } = t, { begin: a, size: r } = s;
|
|
2332
|
+
nt(o, "slice");
|
|
2333
|
+
const [i, l] = Fn(o, a, r);
|
|
2334
|
+
yn(o, i, l);
|
|
2335
|
+
const u = n.data.get(o.dataId).values, h = Ue(u, i, l, o.shape, o.dtype);
|
|
2336
|
+
return n.makeTensorInfo(l, o.dtype, h);
|
|
2337
|
+
}
|
|
2338
|
+
const No = {
|
|
2339
|
+
kernelName: Ye,
|
|
2340
|
+
backendName: "cpu",
|
|
2341
|
+
kernelFunc: ks
|
|
2342
|
+
};
|
|
2343
|
+
/**
|
|
2344
|
+
* @license
|
|
2345
|
+
* Copyright 2021 Google LLC. All Rights Reserved.
|
|
2346
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2347
|
+
* you may not use this file except in compliance with the License.
|
|
2348
|
+
* You may obtain a copy of the License at
|
|
2349
|
+
*
|
|
2350
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2351
|
+
*
|
|
2352
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2353
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2354
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2355
|
+
* See the License for the specific language governing permissions and
|
|
2356
|
+
* limitations under the License.
|
|
2357
|
+
* =============================================================================
|
|
2358
|
+
*/
|
|
2359
|
+
function Ns(e, t, n, s, o, a, r) {
|
|
2360
|
+
const i = t[0], l = a[0], u = new Array(l), h = new Array(i), f = t[1];
|
|
2361
|
+
if (l === 0) {
|
|
2362
|
+
if (i !== 0)
|
|
2363
|
+
throw new Error(on(i));
|
|
2364
|
+
const g = D(n, 0), d = D(o, 0);
|
|
2365
|
+
return [
|
|
2366
|
+
g,
|
|
2367
|
+
[0, f],
|
|
2368
|
+
d,
|
|
2369
|
+
u,
|
|
2370
|
+
h
|
|
2371
|
+
];
|
|
2372
|
+
}
|
|
2373
|
+
let p = !0, I = 0;
|
|
2374
|
+
const m = new Array(l).fill(0);
|
|
2375
|
+
for (let g = 0; g < i; ++g) {
|
|
2376
|
+
const d = e[g * f];
|
|
2377
|
+
if (d < 0)
|
|
2378
|
+
throw new Error(rn(g, d));
|
|
2379
|
+
if (d >= l)
|
|
2380
|
+
throw new Error(an(g, d, l));
|
|
2381
|
+
++m[d], p = p && d >= I, I = d;
|
|
2382
|
+
}
|
|
2383
|
+
let F = !0;
|
|
2384
|
+
for (let g = 0; g < l; ++g) {
|
|
2385
|
+
const d = m[g] === 0;
|
|
2386
|
+
u[g] = d, F = F && !d, m[g] = Math.max(m[g], 1), g > 0 && (m[g] += m[g - 1]);
|
|
2387
|
+
}
|
|
2388
|
+
if (F && p) {
|
|
2389
|
+
const g = e, d = s;
|
|
2390
|
+
for (let b = 0; b < i; ++b)
|
|
2391
|
+
h[b] = b;
|
|
2392
|
+
return [
|
|
2393
|
+
g,
|
|
2394
|
+
[i, f],
|
|
2395
|
+
d,
|
|
2396
|
+
u,
|
|
2397
|
+
h
|
|
2398
|
+
];
|
|
2399
|
+
} else {
|
|
2400
|
+
const g = m[l - 1], d = D(n, g * f), b = D(o, g), k = new Array(l).fill(0);
|
|
2401
|
+
for (let y = 0; y < i; ++y) {
|
|
2402
|
+
const S = e[y * f], P = k[S], C = (S === 0 ? 0 : m[S - 1]) + P;
|
|
2403
|
+
k[S]++;
|
|
2404
|
+
for (let v = 0; v < f; ++v)
|
|
2405
|
+
d[C * f + v] = e[y * f + v];
|
|
2406
|
+
b[C] = s[y], h[y] = C;
|
|
2407
|
+
}
|
|
2408
|
+
for (let y = 0; y < l; ++y)
|
|
2409
|
+
if (k[y] === 0) {
|
|
2410
|
+
const P = y === 0 ? 0 : m[y - 1];
|
|
2411
|
+
d[P * f + 0] = y;
|
|
2412
|
+
for (let C = 1; C < f; ++C)
|
|
2413
|
+
d[P * f + C] = 0;
|
|
2414
|
+
b[P] = r;
|
|
2415
|
+
}
|
|
2416
|
+
return [
|
|
2417
|
+
d,
|
|
2418
|
+
[g, f],
|
|
2419
|
+
b,
|
|
2420
|
+
u,
|
|
2421
|
+
h
|
|
2422
|
+
];
|
|
2423
|
+
}
|
|
2424
|
+
}
|
|
2425
|
+
/**
|
|
2426
|
+
* @license
|
|
2427
|
+
* Copyright 2021 Google LLC. All Rights Reserved.
|
|
2428
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2429
|
+
* you may not use this file except in compliance with the License.
|
|
2430
|
+
* You may obtain a copy of the License at
|
|
2431
|
+
*
|
|
2432
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2433
|
+
*
|
|
2434
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2435
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2436
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2437
|
+
* See the License for the specific language governing permissions and
|
|
2438
|
+
* limitations under the License.
|
|
2439
|
+
* =============================================================================
|
|
2440
|
+
*/
|
|
2441
|
+
function Ss(e, t, n, s, o) {
|
|
2442
|
+
const a = A(s), r = t[0], i = o.length, l = [];
|
|
2443
|
+
let u = 1, h = -1;
|
|
2444
|
+
for (let g = 0; g < i; ++g) {
|
|
2445
|
+
const d = o[g];
|
|
2446
|
+
if (d === -1) {
|
|
2447
|
+
if (h !== -1)
|
|
2448
|
+
throw new Error(ln(h, g));
|
|
2449
|
+
h = g, l.push(1);
|
|
2450
|
+
} else {
|
|
2451
|
+
if (d < 0)
|
|
2452
|
+
throw new Error(cn(g, d));
|
|
2453
|
+
u *= d, l.push(d);
|
|
2454
|
+
}
|
|
2455
|
+
}
|
|
2456
|
+
if (h !== -1) {
|
|
2457
|
+
if (u <= 0)
|
|
2458
|
+
throw new Error(un());
|
|
2459
|
+
const g = Math.trunc(a / u);
|
|
2460
|
+
if (u * g !== a)
|
|
2461
|
+
throw new Error(hn(s, l));
|
|
2462
|
+
l[h] = g;
|
|
2463
|
+
}
|
|
2464
|
+
if (A(l) !== a)
|
|
2465
|
+
throw new Error(fn(s, l));
|
|
2466
|
+
const p = s.length, I = [];
|
|
2467
|
+
if (p > 0) {
|
|
2468
|
+
I[p - 1] = 1;
|
|
2469
|
+
for (let g = p - 2; g >= 0; --g)
|
|
2470
|
+
I[g] = I[g + 1] * s[g + 1];
|
|
2471
|
+
}
|
|
2472
|
+
const m = [];
|
|
2473
|
+
if (i > 0) {
|
|
2474
|
+
m[i - 1] = 1;
|
|
2475
|
+
for (let g = i - 2; g >= 0; --g)
|
|
2476
|
+
m[g] = m[g + 1] * l[g + 1];
|
|
2477
|
+
}
|
|
2478
|
+
const F = D(n, r * i);
|
|
2479
|
+
for (let g = 0; g < r; ++g) {
|
|
2480
|
+
let d = 0;
|
|
2481
|
+
for (let b = 0; b < p; ++b)
|
|
2482
|
+
d += e[g * p + b] * I[b];
|
|
2483
|
+
for (let b = 0; b < i; ++b)
|
|
2484
|
+
F[g * i + b] = Math.trunc(d / m[b]), d %= m[b];
|
|
2485
|
+
}
|
|
2486
|
+
return [F, [r, i], l];
|
|
2487
|
+
}
|
|
2488
|
+
/**
|
|
2489
|
+
* @license
|
|
2490
|
+
* Copyright 2021 Google LLC. All Rights Reserved.
|
|
2491
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2492
|
+
* you may not use this file except in compliance with the License.
|
|
2493
|
+
* You may obtain a copy of the License at
|
|
2494
|
+
*
|
|
2495
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2496
|
+
*
|
|
2497
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2498
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2499
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2500
|
+
* See the License for the specific language governing permissions and
|
|
2501
|
+
* limitations under the License.
|
|
2502
|
+
* =============================================================================
|
|
2503
|
+
*/
|
|
2504
|
+
function vs(e, t, n, s, o, a = !1, r = 0) {
|
|
2505
|
+
const i = s.length, l = [t[0], e.length / t[0]], u = l[1], f = i > 0 ? o[i - 1] + 1 : 0;
|
|
2506
|
+
if (f < 0)
|
|
2507
|
+
throw new Error(Nt());
|
|
2508
|
+
const p = t.slice();
|
|
2509
|
+
p[0] = f;
|
|
2510
|
+
const I = p.reduce((k, y) => k * y, 1), m = D(n, I);
|
|
2511
|
+
if (i === 0)
|
|
2512
|
+
return f > 0 && m.fill(r), [m, p];
|
|
2513
|
+
if (f <= 0)
|
|
2514
|
+
throw new Error(Nt());
|
|
2515
|
+
let F = 0, g = 1, d = 0, b = o[F];
|
|
2516
|
+
for (; ; ) {
|
|
2517
|
+
let k = 0;
|
|
2518
|
+
if (g < i) {
|
|
2519
|
+
if (k = o[g], b === k) {
|
|
2520
|
+
++g;
|
|
2521
|
+
continue;
|
|
2522
|
+
}
|
|
2523
|
+
if (b >= k)
|
|
2524
|
+
throw new Error(gn());
|
|
2525
|
+
}
|
|
2526
|
+
if (b < 0 || b >= f)
|
|
2527
|
+
throw new Error(dn(b, f));
|
|
2528
|
+
b > d && m.fill(r, d * u, b * u);
|
|
2529
|
+
for (let y = F; y < g; ++y) {
|
|
2530
|
+
const S = s[y];
|
|
2531
|
+
if (S < 0 || S >= l[0])
|
|
2532
|
+
throw new Error(mn(y, s[y], l[0]));
|
|
2533
|
+
for (let P = 0; P < u; P++)
|
|
2534
|
+
m[b * u + P] += e[S * u + P];
|
|
2535
|
+
}
|
|
2536
|
+
if (a)
|
|
2537
|
+
for (let y = 0; y < u; y++)
|
|
2538
|
+
m[b * u + y] /= g - F;
|
|
2539
|
+
if (F = g, ++g, d = b + 1, b = k, g > i)
|
|
2540
|
+
break;
|
|
2541
|
+
}
|
|
2542
|
+
return d < f && m.fill(r, d * u, f * u), [m, p];
|
|
2543
|
+
}
|
|
2544
|
+
/**
|
|
2545
|
+
* @license
|
|
2546
|
+
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
2547
|
+
* Licensed under the Apache License, Version 2.0 (the License);
|
|
2548
|
+
* you may not use this file except in compliance with the License.
|
|
2549
|
+
* You may obtain a copy of the License at
|
|
2550
|
+
*
|
|
2551
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2552
|
+
*
|
|
2553
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2554
|
+
* distributed under the License is distributed on an AS IS BASIS,
|
|
2555
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2556
|
+
* See the License for the specific language governing permissions and
|
|
2557
|
+
* limitations under the License.
|
|
2558
|
+
* =============================================================================
|
|
2559
|
+
*/
|
|
2560
|
+
const Ts = X((e) => Math.sqrt(e)), Rs = ge(te, (e) => Math.sqrt(e)), So = {
|
|
2561
|
+
kernelName: te,
|
|
2562
|
+
backendName: "cpu",
|
|
2563
|
+
kernelFunc: Rs
|
|
2564
|
+
};
|
|
2565
|
+
/**
|
|
2566
|
+
* @license
|
|
2567
|
+
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
2568
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2569
|
+
* you may not use this file except in compliance with the License.
|
|
2570
|
+
* You may obtain a copy of the License at
|
|
2571
|
+
*
|
|
2572
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2573
|
+
*
|
|
2574
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2575
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2576
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2577
|
+
* See the License for the specific language governing permissions and
|
|
2578
|
+
* limitations under the License.
|
|
2579
|
+
* =============================================================================
|
|
2580
|
+
*/
|
|
2581
|
+
const Me = W((e, t) => {
|
|
2582
|
+
const n = e - t;
|
|
2583
|
+
return n * n;
|
|
2584
|
+
}), Ps = z(ee, Me), vo = {
|
|
2585
|
+
kernelName: ee,
|
|
2586
|
+
backendName: "cpu",
|
|
2587
|
+
kernelFunc: Ps
|
|
2588
|
+
};
|
|
2589
|
+
/**
|
|
2590
|
+
* @license
|
|
2591
|
+
* Copyright 2023 Google LLC.
|
|
2592
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2593
|
+
* you may not use this file except in compliance with the License.
|
|
2594
|
+
* You may obtain a copy of the License at
|
|
2595
|
+
*
|
|
2596
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2597
|
+
*
|
|
2598
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2599
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2600
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2601
|
+
* See the License for the specific language governing permissions and
|
|
2602
|
+
* limitations under the License.
|
|
2603
|
+
* =============================================================================
|
|
2604
|
+
*/
|
|
2605
|
+
const Oe = X((e, t) => {
|
|
2606
|
+
const { pattern: n, replaceGlobal: s, rewrite: o } = t;
|
|
2607
|
+
return e.replace(new RegExp(n, s ? "g" : ""), o);
|
|
2608
|
+
}), Cs = J(ne, Oe), To = {
|
|
2609
|
+
kernelName: ne,
|
|
2610
|
+
backendName: "cpu",
|
|
2611
|
+
kernelFunc: Cs
|
|
2612
|
+
};
|
|
2613
|
+
/**
|
|
2614
|
+
* @license
|
|
2615
|
+
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
2616
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2617
|
+
* you may not use this file except in compliance with the License.
|
|
2618
|
+
* You may obtain a copy of the License at
|
|
2619
|
+
*
|
|
2620
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2621
|
+
*
|
|
2622
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2623
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2624
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2625
|
+
* See the License for the specific language governing permissions and
|
|
2626
|
+
* limitations under the License.
|
|
2627
|
+
* =============================================================================
|
|
2628
|
+
*/
|
|
2629
|
+
function qs(e, t, n, s) {
|
|
2630
|
+
const o = H(e, t.dtype);
|
|
2631
|
+
for (let a = 0; a < o.size; a++) {
|
|
2632
|
+
const r = o.indexToLoc(a), i = new Array(r.length);
|
|
2633
|
+
for (let l = 0; l < i.length; l++)
|
|
2634
|
+
i[l] = r[l] * n[l] + s[l];
|
|
2635
|
+
o.set(t.get(...i), ...r);
|
|
2636
|
+
}
|
|
2637
|
+
return o;
|
|
2638
|
+
}
|
|
2639
|
+
/**
|
|
2640
|
+
* @license
|
|
2641
|
+
* Copyright 2021 Google LLC. All Rights Reserved.
|
|
2642
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2643
|
+
* you may not use this file except in compliance with the License.
|
|
2644
|
+
* You may obtain a copy of the License at
|
|
2645
|
+
*
|
|
2646
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2647
|
+
*
|
|
2648
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2649
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2650
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2651
|
+
* See the License for the specific language governing permissions and
|
|
2652
|
+
* limitations under the License.
|
|
2653
|
+
* =============================================================================
|
|
2654
|
+
*/
|
|
2655
|
+
class Us {
|
|
2656
|
+
constructor(t, n, s, o, a, r) {
|
|
2657
|
+
this.separator = pt(t), this.nGramWidths = n, this.leftPad = pt(s), this.rightPad = pt(o), this.padWidth = a, this.preserveShort = r;
|
|
2658
|
+
}
|
|
2659
|
+
getPadWidth(t) {
|
|
2660
|
+
return Math.min(this.padWidth < 0 ? t - 1 : this.padWidth, t - 1);
|
|
2661
|
+
}
|
|
2662
|
+
getNumNGrams(t, n) {
|
|
2663
|
+
const s = this.getPadWidth(n);
|
|
2664
|
+
return Math.max(0, t + 2 * s - n + 1);
|
|
2665
|
+
}
|
|
2666
|
+
createNGrams(t, n, s, o, a, r) {
|
|
2667
|
+
for (let i = 0; i < a; ++i) {
|
|
2668
|
+
const l = this.getPadWidth(r), u = Math.max(0, l - i), h = Math.max(0, l - (a - (i + 1))), f = r - (u + h), p = n + (u > 0 ? 0 : i - l);
|
|
2669
|
+
let I = 0;
|
|
2670
|
+
I += u * this.leftPad.length;
|
|
2671
|
+
for (let b = 0; b < f; ++b)
|
|
2672
|
+
I += t[p + b].length;
|
|
2673
|
+
I += h * this.rightPad.length;
|
|
2674
|
+
const m = u + h + f - 1;
|
|
2675
|
+
I += m * this.separator.length, s[o + i] = new Uint8Array(I);
|
|
2676
|
+
const F = s[o + i];
|
|
2677
|
+
let g = 0;
|
|
2678
|
+
const d = (b) => b.forEach((k) => F[g++] = k);
|
|
2679
|
+
for (let b = 0; b < u; ++b)
|
|
2680
|
+
d(this.leftPad), d(this.separator);
|
|
2681
|
+
for (let b = 0; b < f - 1; ++b)
|
|
2682
|
+
d(t[p + b]), d(this.separator);
|
|
2683
|
+
if (f > 0) {
|
|
2684
|
+
d(t[p + f - 1]);
|
|
2685
|
+
for (let b = 0; b < h; ++b)
|
|
2686
|
+
d(this.separator), d(this.rightPad);
|
|
2687
|
+
} else {
|
|
2688
|
+
for (let b = 0; b < h - 1; ++b)
|
|
2689
|
+
d(this.rightPad), d(this.separator);
|
|
2690
|
+
d(this.rightPad);
|
|
2691
|
+
}
|
|
2692
|
+
}
|
|
2693
|
+
}
|
|
2694
|
+
// Data and splits together form the definition of the ragged tensor,
|
|
2695
|
+
// where data is 1 dimensional and contains the values of the tensor
|
|
2696
|
+
// and splits denotes the indices at which each row starts.
|
|
2697
|
+
compute(t, n) {
|
|
2698
|
+
const s = t.length, o = n.length;
|
|
2699
|
+
if (o > 0) {
|
|
2700
|
+
let l = n[0];
|
|
2701
|
+
if (l !== 0)
|
|
2702
|
+
throw new Error(`First split value must be 0, got ${l}`);
|
|
2703
|
+
for (let u = 1; u < o; ++u) {
|
|
2704
|
+
let h = n[u] >= l;
|
|
2705
|
+
if (h = h && n[u] <= s, !h)
|
|
2706
|
+
throw new Error(`Invalid split value ${n[u]}, must be in [${l}, ${s}]`);
|
|
2707
|
+
l = n[u];
|
|
2708
|
+
}
|
|
2709
|
+
if (l !== s)
|
|
2710
|
+
throw new Error(`Last split value must be data size. Expected ${s}, got ${l}`);
|
|
2711
|
+
}
|
|
2712
|
+
const a = o - 1, r = D("int32", o);
|
|
2713
|
+
if (s === 0 || o === 0) {
|
|
2714
|
+
const l = new Array(s);
|
|
2715
|
+
for (let u = 0; u <= a; ++u)
|
|
2716
|
+
r[u] = 0;
|
|
2717
|
+
return [l, r];
|
|
2718
|
+
}
|
|
2719
|
+
r[0] = 0;
|
|
2720
|
+
for (let l = 1; l <= a; ++l) {
|
|
2721
|
+
const u = n[l] - n[l - 1];
|
|
2722
|
+
let h = 0;
|
|
2723
|
+
this.nGramWidths.forEach((f) => {
|
|
2724
|
+
h += this.getNumNGrams(u, f);
|
|
2725
|
+
}), this.preserveShort && u > 0 && h === 0 && (h = 1), r[l] = r[l - 1] + h;
|
|
2726
|
+
}
|
|
2727
|
+
const i = new Array(r[a]);
|
|
2728
|
+
for (let l = 0; l < a; ++l) {
|
|
2729
|
+
const u = n[l];
|
|
2730
|
+
let h = r[l];
|
|
2731
|
+
if (this.nGramWidths.forEach((f) => {
|
|
2732
|
+
const p = n[l + 1] - n[l], I = this.getNumNGrams(p, f);
|
|
2733
|
+
this.createNGrams(t, u, i, h, I, f), h += I;
|
|
2734
|
+
}), this.preserveShort && h === r[l]) {
|
|
2735
|
+
const f = n[l + 1] - n[l];
|
|
2736
|
+
if (f === 0)
|
|
2737
|
+
continue;
|
|
2738
|
+
const p = f + 2 * this.padWidth;
|
|
2739
|
+
this.createNGrams(t, u, i, h, 1, p);
|
|
2740
|
+
}
|
|
2741
|
+
}
|
|
2742
|
+
return [i, r];
|
|
2743
|
+
}
|
|
2744
|
+
}
|
|
2745
|
+
function Ms(e, t, n, s, o, a, r, i) {
|
|
2746
|
+
return new Us(n, s, o, a, r, i).compute(e, t);
|
|
2747
|
+
}
|
|
2748
|
+
/**
|
|
2749
|
+
* @license
|
|
2750
|
+
* Copyright 2021 Google LLC. All Rights Reserved.
|
|
2751
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2752
|
+
* you may not use this file except in compliance with the License.
|
|
2753
|
+
* You may obtain a copy of the License at
|
|
2754
|
+
*
|
|
2755
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2756
|
+
*
|
|
2757
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2758
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2759
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2760
|
+
* See the License for the specific language governing permissions and
|
|
2761
|
+
* limitations under the License.
|
|
2762
|
+
* =============================================================================
|
|
2763
|
+
*/
|
|
2764
|
+
function Os(e, t, n, s) {
|
|
2765
|
+
if (!e.length)
|
|
2766
|
+
return;
|
|
2767
|
+
if (t.length === 0) {
|
|
2768
|
+
for (let a = 0; a < e.length; ++a)
|
|
2769
|
+
s.push(e.subarray(a, a + 1));
|
|
2770
|
+
return;
|
|
2771
|
+
}
|
|
2772
|
+
if (t.length === 1) {
|
|
2773
|
+
const a = t[0];
|
|
2774
|
+
let r = e.indexOf(a);
|
|
2775
|
+
for (; r !== -1; ) {
|
|
2776
|
+
const i = e.subarray(0, r);
|
|
2777
|
+
(!n || i.length !== 0) && s.push(i), e = e.subarray(r + 1), r = e.indexOf(a);
|
|
2778
|
+
}
|
|
2779
|
+
(!n || e.length !== 0) && s.push(e);
|
|
2780
|
+
return;
|
|
2781
|
+
}
|
|
2782
|
+
let o = 0;
|
|
2783
|
+
for (let a = 0; a < e.length + 1; a++)
|
|
2784
|
+
if (a === e.length || t.indexOf(e[a]) !== -1) {
|
|
2785
|
+
const r = e.subarray(o, a);
|
|
2786
|
+
(!n || r.length !== 0) && s.push(r), o = a + 1;
|
|
2787
|
+
}
|
|
2788
|
+
}
|
|
2789
|
+
function Ls(e, t, n) {
|
|
2790
|
+
const s = e.length, o = [];
|
|
2791
|
+
let a = 0, r = 0;
|
|
2792
|
+
const i = new Array(s);
|
|
2793
|
+
for (let p = 0; p < s; ++p) {
|
|
2794
|
+
const I = o.length;
|
|
2795
|
+
Os(e[p], t, n, o);
|
|
2796
|
+
const m = o.length - I;
|
|
2797
|
+
i[p] = m, a += m, r = Math.max(r, m);
|
|
2798
|
+
}
|
|
2799
|
+
const l = D("int32", a * 2), u = new Array(a), h = [s, r];
|
|
2800
|
+
let f = 0;
|
|
2801
|
+
for (let p = 0; p < s; ++p)
|
|
2802
|
+
for (let I = 0; I < i[p]; ++I)
|
|
2803
|
+
l[f * 2] = p, l[f * 2 + 1] = I, u[f] = o[f], ++f;
|
|
2804
|
+
return [l, u, h];
|
|
2805
|
+
}
|
|
2806
|
+
/**
|
|
2807
|
+
* @license
|
|
2808
|
+
* Copyright 2021 Google LLC. All Rights Reserved.
|
|
2809
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2810
|
+
* you may not use this file except in compliance with the License.
|
|
2811
|
+
* You may obtain a copy of the License at
|
|
2812
|
+
*
|
|
2813
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2814
|
+
*
|
|
2815
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2816
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2817
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2818
|
+
* See the License for the specific language governing permissions and
|
|
2819
|
+
* limitations under the License.
|
|
2820
|
+
* =============================================================================
|
|
2821
|
+
*/
|
|
2822
|
+
function As(e, t) {
|
|
2823
|
+
const n = D("int32", e.length);
|
|
2824
|
+
for (let s = 0; s < e.length; ++s)
|
|
2825
|
+
n[s] = Mn(e[s]).modulo(t).getLowBitsUnsigned();
|
|
2826
|
+
return n;
|
|
2827
|
+
}
|
|
2828
|
+
/**
|
|
2829
|
+
* @license
|
|
2830
|
+
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
2831
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2832
|
+
* you may not use this file except in compliance with the License.
|
|
2833
|
+
* You may obtain a copy of the License at
|
|
2834
|
+
*
|
|
2835
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2836
|
+
*
|
|
2837
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2838
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2839
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2840
|
+
* See the License for the specific language governing permissions and
|
|
2841
|
+
* limitations under the License.
|
|
2842
|
+
* =============================================================================
|
|
2843
|
+
*/
|
|
2844
|
+
const Le = W((e, t) => e - t), _s = Ft((e, t, n, s) => ({ real: e - n, imag: t - s })), Vs = z(se, Le, _s), Ro = {
|
|
2845
|
+
kernelName: se,
|
|
2846
|
+
backendName: "cpu",
|
|
2847
|
+
kernelFunc: Vs
|
|
2848
|
+
};
|
|
2849
|
+
/**
|
|
2850
|
+
* @license
|
|
2851
|
+
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
2852
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2853
|
+
* you may not use this file except in compliance with the License.
|
|
2854
|
+
* You may obtain a copy of the License at
|
|
2855
|
+
*
|
|
2856
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2857
|
+
*
|
|
2858
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2859
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2860
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2861
|
+
* See the License for the specific language governing permissions and
|
|
2862
|
+
* limitations under the License.
|
|
2863
|
+
* =============================================================================
|
|
2864
|
+
*/
|
|
2865
|
+
function Ds(e, t) {
|
|
2866
|
+
const n = new Array(e.rank);
|
|
2867
|
+
for (let o = 0; o < n.length; o++)
|
|
2868
|
+
n[o] = e.shape[o] * t[o];
|
|
2869
|
+
const s = H(n, e.dtype);
|
|
2870
|
+
for (let o = 0; o < s.values.length; ++o) {
|
|
2871
|
+
const a = s.indexToLoc(o), r = new Array(e.rank);
|
|
2872
|
+
for (let l = 0; l < r.length; l++)
|
|
2873
|
+
r[l] = a[l] % e.shape[l];
|
|
2874
|
+
const i = e.locToIndex(r);
|
|
2875
|
+
s.values[o] = e.values[i];
|
|
2876
|
+
}
|
|
2877
|
+
return s;
|
|
2878
|
+
}
|
|
2879
|
+
/**
|
|
2880
|
+
* @license
|
|
2881
|
+
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
2882
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2883
|
+
* you may not use this file except in compliance with the License.
|
|
2884
|
+
* You may obtain a copy of the License at
|
|
2885
|
+
*
|
|
2886
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2887
|
+
*
|
|
2888
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2889
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2890
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2891
|
+
* See the License for the specific language governing permissions and
|
|
2892
|
+
* limitations under the License.
|
|
2893
|
+
* =============================================================================
|
|
2894
|
+
*/
|
|
2895
|
+
const rt = (e, t) => {
|
|
2896
|
+
const n = t.value - e.value;
|
|
2897
|
+
return n === 0 ? e.index - t.index : n;
|
|
2898
|
+
};
|
|
2899
|
+
function Ae(e, t, n = 0, s = e.length - 1) {
|
|
2900
|
+
for (; s > n; ) {
|
|
2901
|
+
if (s - n > 600) {
|
|
2902
|
+
const i = s - n + 1, l = t - n + 1, u = Math.log(i), h = 0.5 * Math.exp(2 * u / 3), f = 0.5 * Math.sqrt(u * h * (i - h) / i) * Math.sign(l - i / 2), p = Math.max(n, Math.floor(t - l * h / i + f)), I = Math.min(s, Math.floor(t + (i - l) * h / i + f));
|
|
2903
|
+
Ae(e, t, p, I);
|
|
2904
|
+
}
|
|
2905
|
+
const o = e[t];
|
|
2906
|
+
let a = n, r = s;
|
|
2907
|
+
for (ot(e, n, t), rt(e[s], o) > 0 && ot(e, n, s); a < r; ) {
|
|
2908
|
+
for (ot(e, a, r), a++, r--; rt(e[a], o) < 0; )
|
|
2909
|
+
a = a + 1;
|
|
2910
|
+
for (; rt(e[r], o) > 0; )
|
|
2911
|
+
r = r - 1;
|
|
2912
|
+
}
|
|
2913
|
+
rt(e[n], o) === 0 ? ot(e, n, r) : (r = r + 1, ot(e, r, s)), r <= t && (n = r + 1), t <= r && (s = r - 1);
|
|
2914
|
+
}
|
|
2915
|
+
}
|
|
2916
|
+
function Ws(e, t, n, s, o) {
|
|
2917
|
+
const a = t[t.length - 1], [r, i] = [e.length / a, a], l = et(n, r * s), u = et("int32", r * s);
|
|
2918
|
+
for (let f = 0; f < r; f++) {
|
|
2919
|
+
const p = f * i, I = e.subarray(p, p + i);
|
|
2920
|
+
let m = new Array(I.length);
|
|
2921
|
+
I.forEach((b, k) => m[k] = { value: b, index: k }), s < m.length && (Ae(m, s), m = m.slice(0, s)), o && m.sort(rt);
|
|
2922
|
+
const F = f * s, g = l.subarray(F, F + s), d = u.subarray(F, F + s);
|
|
2923
|
+
for (let b = 0; b < s; b++)
|
|
2924
|
+
g[b] = m[b].value, d[b] = m[b].index;
|
|
2925
|
+
}
|
|
2926
|
+
const h = t.slice();
|
|
2927
|
+
return h[h.length - 1] = s, [
|
|
2928
|
+
H(h, n, l),
|
|
2929
|
+
H(h, "int32", u)
|
|
2930
|
+
];
|
|
2931
|
+
}
|
|
2932
|
+
/**
|
|
2933
|
+
* @license
|
|
2934
|
+
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
2935
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2936
|
+
* you may not use this file except in compliance with the License.
|
|
2937
|
+
* You may obtain a copy of the License at
|
|
2938
|
+
*
|
|
2939
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2940
|
+
*
|
|
2941
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2942
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2943
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2944
|
+
* See the License for the specific language governing permissions and
|
|
2945
|
+
* limitations under the License.
|
|
2946
|
+
* =============================================================================
|
|
2947
|
+
*/
|
|
2948
|
+
function $s(e, t, n, s) {
|
|
2949
|
+
const o = Yt(t, n)[0], a = [1, n[0], 1];
|
|
2950
|
+
for (let m = 0; m < o; m++)
|
|
2951
|
+
a[0] *= n[m];
|
|
2952
|
+
a[1] = n[o];
|
|
2953
|
+
for (let m = o + 1; m < n.length; m++)
|
|
2954
|
+
a[2] *= n[m];
|
|
2955
|
+
const r = /* @__PURE__ */ new Map(), i = new Int32Array(n[o]), l = new wt(a, s, e), u = [], h = a[0] === 1 && a[2] === 1;
|
|
2956
|
+
for (let m = 0; m < n[o]; m++) {
|
|
2957
|
+
let F;
|
|
2958
|
+
if (h)
|
|
2959
|
+
F = e[m].toString();
|
|
2960
|
+
else {
|
|
2961
|
+
const d = [];
|
|
2962
|
+
for (let b = 0; b < a[0]; b++)
|
|
2963
|
+
for (let k = 0; k < a[2]; k++)
|
|
2964
|
+
d.push(l.get(b, m, k));
|
|
2965
|
+
F = d.join(",");
|
|
2966
|
+
}
|
|
2967
|
+
const g = r.get(F);
|
|
2968
|
+
if (g != null)
|
|
2969
|
+
i[m] = g;
|
|
2970
|
+
else {
|
|
2971
|
+
const d = r.size;
|
|
2972
|
+
r.set(F, d), i[m] = d, u.push(m);
|
|
2973
|
+
}
|
|
2974
|
+
}
|
|
2975
|
+
const f = a.slice();
|
|
2976
|
+
f[1] = r.size;
|
|
2977
|
+
const p = new wt(f, s);
|
|
2978
|
+
u.forEach((m, F) => {
|
|
2979
|
+
for (let g = 0; g < a[0]; g++)
|
|
2980
|
+
for (let d = 0; d < a[2]; d++)
|
|
2981
|
+
p.set(l.get(g, m, d), g, F, d);
|
|
2982
|
+
});
|
|
2983
|
+
const I = n.slice();
|
|
2984
|
+
return I[o] = f[1], {
|
|
2985
|
+
outputValues: p.values,
|
|
2986
|
+
outputShape: I,
|
|
2987
|
+
indices: i
|
|
2988
|
+
};
|
|
2989
|
+
}
|
|
2990
|
+
/**
|
|
2991
|
+
* @license
|
|
2992
|
+
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
2993
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2994
|
+
* you may not use this file except in compliance with the License.
|
|
2995
|
+
* You may obtain a copy of the License at
|
|
2996
|
+
*
|
|
2997
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2998
|
+
*
|
|
2999
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3000
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3001
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3002
|
+
* See the License for the specific language governing permissions and
|
|
3003
|
+
* limitations under the License.
|
|
3004
|
+
* =============================================================================
|
|
3005
|
+
*/
|
|
3006
|
+
const zs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3007
|
+
__proto__: null,
|
|
3008
|
+
addImpl: he,
|
|
3009
|
+
bincountImpl: _n,
|
|
3010
|
+
bincountReduceImpl: Vn,
|
|
3011
|
+
bitwiseAndImpl: fe,
|
|
3012
|
+
castImpl: ue,
|
|
3013
|
+
ceilImpl: de,
|
|
3014
|
+
concatImpl: $n,
|
|
3015
|
+
equalImpl: me,
|
|
3016
|
+
expImpl: pe,
|
|
3017
|
+
expm1Impl: Ie,
|
|
3018
|
+
floorDivImpl: be,
|
|
3019
|
+
floorImpl: we,
|
|
3020
|
+
gatherNdImpl: Hn,
|
|
3021
|
+
gatherV2Impl: Kn,
|
|
3022
|
+
greaterEqualImpl: Ee,
|
|
3023
|
+
greaterImpl: xe,
|
|
3024
|
+
lessEqualImpl: ye,
|
|
3025
|
+
lessImpl: Fe,
|
|
3026
|
+
linSpaceImpl: ts,
|
|
3027
|
+
logImpl: ke,
|
|
3028
|
+
maxImpl: ns,
|
|
3029
|
+
maximumImpl: Ne,
|
|
3030
|
+
minimumImpl: Se,
|
|
3031
|
+
multiplyImpl: yt,
|
|
3032
|
+
negImpl: ve,
|
|
3033
|
+
notEqualImpl: Te,
|
|
3034
|
+
prodImpl: Ce,
|
|
3035
|
+
raggedGatherImpl: ps,
|
|
3036
|
+
raggedRangeImpl: Is,
|
|
3037
|
+
raggedTensorToTensorImpl: ws,
|
|
3038
|
+
rangeImpl: bs,
|
|
3039
|
+
rsqrtImpl: qe,
|
|
3040
|
+
scatterImpl: Es,
|
|
3041
|
+
sigmoidImpl: Fs,
|
|
3042
|
+
simpleAbsImpl: le,
|
|
3043
|
+
sliceImpl: Ue,
|
|
3044
|
+
sparseFillEmptyRowsImpl: Ns,
|
|
3045
|
+
sparseReshapeImpl: Ss,
|
|
3046
|
+
sparseSegmentReductionImpl: vs,
|
|
3047
|
+
sqrtImpl: Ts,
|
|
3048
|
+
squaredDifferenceImpl: Me,
|
|
3049
|
+
staticRegexReplaceImpl: Oe,
|
|
3050
|
+
stridedSliceImpl: qs,
|
|
3051
|
+
stringNGramsImpl: Ms,
|
|
3052
|
+
stringSplitImpl: Ls,
|
|
3053
|
+
stringToHashBucketFastImpl: As,
|
|
3054
|
+
subImpl: Le,
|
|
3055
|
+
tileImpl: Ds,
|
|
3056
|
+
topKImpl: Ws,
|
|
3057
|
+
transposeImpl: Re,
|
|
3058
|
+
uniqueImpl: $s
|
|
3059
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
3060
|
+
/**
|
|
3061
|
+
* @license
|
|
3062
|
+
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
3063
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3064
|
+
* you may not use this file except in compliance with the License.
|
|
3065
|
+
* You may obtain a copy of the License at
|
|
3066
|
+
*
|
|
3067
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3068
|
+
*
|
|
3069
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3070
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3071
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3072
|
+
* See the License for the specific language governing permissions and
|
|
3073
|
+
* limitations under the License.
|
|
3074
|
+
* =============================================================================
|
|
3075
|
+
*/
|
|
3076
|
+
const { addImpl: Po, bincountImpl: Co, bincountReduceImpl: qo, bitwiseAndImpl: Uo, castImpl: Mo, ceilImpl: Oo, concatImpl: Lo, equalImpl: Ao, expImpl: _o, expm1Impl: Vo, floorImpl: Do, gatherNdImpl: Wo, gatherV2Impl: $o, greaterImpl: zo, greaterEqualImpl: Bo, lessImpl: Go, lessEqualImpl: jo, linSpaceImpl: Zo, logImpl: Ho, maxImpl: Ko, maximumImpl: Xo, minimumImpl: Yo, multiplyImpl: Jo, negImpl: Qo, notEqualImpl: tr, prodImpl: er, raggedGatherImpl: nr, raggedRangeImpl: sr, raggedTensorToTensorImpl: or, rangeImpl: rr, rsqrtImpl: ar, scatterImpl: ir, sigmoidImpl: lr, simpleAbsImpl: cr, sliceImpl: ur, sparseFillEmptyRowsImpl: hr, sparseReshapeImpl: fr, sparseSegmentReductionImpl: gr, sqrtImpl: dr, staticRegexReplaceImpl: mr, stridedSliceImpl: pr, stringNGramsImpl: Ir, stringSplitImpl: wr, stringToHashBucketFastImpl: br, subImpl: xr, tileImpl: Er, topKImpl: Fr, transposeImpl: yr, uniqueImpl: kr } = zs;
|
|
3077
|
+
export {
|
|
3078
|
+
uo as $,
|
|
3079
|
+
ps as A,
|
|
3080
|
+
Is as B,
|
|
3081
|
+
ws as C,
|
|
3082
|
+
bs as D,
|
|
3083
|
+
Es as E,
|
|
3084
|
+
Ns as F,
|
|
3085
|
+
Ss as G,
|
|
3086
|
+
vs as H,
|
|
3087
|
+
qs as I,
|
|
3088
|
+
Ms as J,
|
|
3089
|
+
Ls as K,
|
|
3090
|
+
As as L,
|
|
3091
|
+
Ds as M,
|
|
3092
|
+
Ws as N,
|
|
3093
|
+
$s as O,
|
|
3094
|
+
zn as P,
|
|
3095
|
+
Ys as Q,
|
|
3096
|
+
no as R,
|
|
3097
|
+
so as S,
|
|
3098
|
+
eo as T,
|
|
3099
|
+
oo as U,
|
|
3100
|
+
Js as V,
|
|
3101
|
+
ro as W,
|
|
3102
|
+
ao as X,
|
|
3103
|
+
io as Y,
|
|
3104
|
+
lo as Z,
|
|
3105
|
+
co as _,
|
|
3106
|
+
nt as a,
|
|
3107
|
+
br as a$,
|
|
3108
|
+
ho as a0,
|
|
3109
|
+
Qs as a1,
|
|
3110
|
+
fo as a2,
|
|
3111
|
+
go as a3,
|
|
3112
|
+
mo as a4,
|
|
3113
|
+
po as a5,
|
|
3114
|
+
Io as a6,
|
|
3115
|
+
wo as a7,
|
|
3116
|
+
bo as a8,
|
|
3117
|
+
xo as a9,
|
|
3118
|
+
$o as aA,
|
|
3119
|
+
zo as aB,
|
|
3120
|
+
Bo as aC,
|
|
3121
|
+
Go as aD,
|
|
3122
|
+
jo as aE,
|
|
3123
|
+
Zo as aF,
|
|
3124
|
+
Ho as aG,
|
|
3125
|
+
Xo as aH,
|
|
3126
|
+
Yo as aI,
|
|
3127
|
+
xr as aJ,
|
|
3128
|
+
Qo as aK,
|
|
3129
|
+
er as aL,
|
|
3130
|
+
nr as aM,
|
|
3131
|
+
sr as aN,
|
|
3132
|
+
or as aO,
|
|
3133
|
+
rr as aP,
|
|
3134
|
+
ar as aQ,
|
|
3135
|
+
lr as aR,
|
|
3136
|
+
hr as aS,
|
|
3137
|
+
fr as aT,
|
|
3138
|
+
gr as aU,
|
|
3139
|
+
ir as aV,
|
|
3140
|
+
dr as aW,
|
|
3141
|
+
mr as aX,
|
|
3142
|
+
pr as aY,
|
|
3143
|
+
Ir as aZ,
|
|
3144
|
+
wr as a_,
|
|
3145
|
+
Fo as aa,
|
|
3146
|
+
to as ab,
|
|
3147
|
+
yo as ac,
|
|
3148
|
+
ko as ad,
|
|
3149
|
+
No as ae,
|
|
3150
|
+
So as af,
|
|
3151
|
+
vo as ag,
|
|
3152
|
+
To as ah,
|
|
3153
|
+
Ro as ai,
|
|
3154
|
+
Eo as aj,
|
|
3155
|
+
cr as ak,
|
|
3156
|
+
Jo as al,
|
|
3157
|
+
Po as am,
|
|
3158
|
+
ur as an,
|
|
3159
|
+
Co as ao,
|
|
3160
|
+
Uo as ap,
|
|
3161
|
+
tr as aq,
|
|
3162
|
+
Mo as ar,
|
|
3163
|
+
Oo as as,
|
|
3164
|
+
Lo as at,
|
|
3165
|
+
qo as au,
|
|
3166
|
+
Ao as av,
|
|
3167
|
+
_o as aw,
|
|
3168
|
+
Vo as ax,
|
|
3169
|
+
Do as ay,
|
|
3170
|
+
Wo as az,
|
|
3171
|
+
An as b,
|
|
3172
|
+
Er as b0,
|
|
3173
|
+
Fr as b1,
|
|
3174
|
+
kr as b2,
|
|
3175
|
+
W as c,
|
|
3176
|
+
Pe as d,
|
|
3177
|
+
z as e,
|
|
3178
|
+
ks as f,
|
|
3179
|
+
_n as g,
|
|
3180
|
+
mt as h,
|
|
3181
|
+
Et as i,
|
|
3182
|
+
$n as j,
|
|
3183
|
+
Vn as k,
|
|
3184
|
+
lt as l,
|
|
3185
|
+
Ko as m,
|
|
3186
|
+
as as n,
|
|
3187
|
+
Vs as o,
|
|
3188
|
+
Hn as p,
|
|
3189
|
+
Kn as q,
|
|
3190
|
+
ce as r,
|
|
3191
|
+
ys as s,
|
|
3192
|
+
yr as t,
|
|
3193
|
+
ge as u,
|
|
3194
|
+
ts as v,
|
|
3195
|
+
Re as w,
|
|
3196
|
+
ns as x,
|
|
3197
|
+
Bn as y,
|
|
3198
|
+
xt as z
|
|
3199
|
+
};
|