@genai-fi/nanogpt 0.6.0 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Generator.js +7 -7
- package/dist/NanoGPTModel.js +70 -121
- package/dist/RealDiv-BYViZwhN.js +540 -0
- package/dist/Reshape-t7Kcikjk.js +127 -0
- package/dist/TeachableLLM.d.ts +2 -0
- package/dist/TeachableLLM.js +34 -27
- package/dist/{TiedEmbedding-BhxWO8QR.js → TiedEmbedding-9WeDwvjO.js} +12 -13
- package/dist/{axis_util-D17qZRQm.js → axis_util-Bu4h7XWV.js} +14 -12
- package/dist/{broadcast_to-BMQLjvt_.js → broadcast_to-DARN-DBD.js} +2 -2
- package/dist/{concat-DhZfF1GY.js → concat-5aPGqw3Z.js} +3 -3
- package/dist/{dataset-oilnemHf.js → dataset-pgqp-YfL.js} +3 -3
- package/dist/{dropout-CrMQPCeG.js → dropout-Bciw46HT.js} +7 -7
- package/dist/{gather-DZCMHZuN.js → gather-DjyCjmOD.js} +1 -1
- package/dist/gpgpu_math-CNslybmD.js +3115 -0
- package/dist/{index-bMBtI-WR.js → index-BAzbokzv.js} +846 -649
- package/dist/{kernel_funcs_utils-CNmjLWnB.js → kernel_funcs_utils-CUxJCg0g.js} +232 -138
- 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/loader/load.d.ts +13 -0
- package/dist/loader/load.js +27 -0
- package/dist/loader/loadHF.d.ts +7 -0
- package/dist/loader/loadHF.js +22 -0
- package/dist/{utilities/load.d.ts → loader/loadTransformers.d.ts} +11 -11
- package/dist/loader/loadTransformers.js +28 -0
- package/dist/loader/newZipLoad.d.ts +8 -0
- package/dist/loader/newZipLoad.js +21 -0
- package/dist/loader/oldZipLoad.d.ts +7 -0
- package/dist/loader/oldZipLoad.js +76 -0
- package/dist/{log_sum_exp-BHdkCb4s.js → log_sum_exp-YEo2h3gb.js} +14 -14
- package/dist/main.js +23 -20
- package/dist/{mat_mul-BsrLfy81.js → mat_mul-7121rsJk.js} +1 -1
- package/dist/{max-DechV4Bc.js → max-DtlIuVeW.js} +1 -1
- package/dist/mulmat_packed_gpu-D4nKF7Je.js +71 -0
- package/dist/{norm-B9hWHZH1.js → norm-CzltS9Fz.js} +16 -16
- package/dist/{ones-g0K8jVwm.js → ones-BBlSRqn1.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 +6 -6
- package/dist/ops/cpu/fusedSoftmax.js +2 -2
- package/dist/ops/cpu/gatherSub.js +9 -9
- 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 +17 -48
- 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 +1 -1
- package/dist/ops/grads/fusedSoftmax.js +4 -4
- 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/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 +29 -560
- package/dist/ops/webgl/gatherSub.js +1 -1
- package/dist/ops/webgl/gelu.js +2 -2
- package/dist/ops/webgl/log.js +3 -3
- package/dist/ops/webgl/matMulGelu.js +46 -113
- 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-Mv7Ta72x.js → ops-C0sQEcPw.js} +117 -109
- package/dist/{random_width-BBAWzDym.js → random_width-DWzaOgrn.js} +6925 -6291
- package/dist/{range-DMaG9A3G.js → range-DYsrnfiy.js} +1 -1
- package/dist/{gpgpu_math-Ctc31slO.js → reciprocal-CJQeasVa.js} +7 -5
- package/dist/register_all_kernels-BfFCQAqs.js +21397 -0
- package/dist/{reshape-T4yDEqoF.js → reshape-krWGKraP.js} +1 -1
- package/dist/scatter_nd_util-93ln7Hut.js +46 -0
- package/dist/selu_util-sntGesxr.js +740 -0
- package/dist/{shared-XNAoXhOa.js → shared-Ca6iDobD.js} +1462 -1089
- package/dist/{sin-EEhbrRO_.js → sin-D_h-qCSx.js} +1 -1
- package/dist/{softmax-B2_IKPDR.js → softmax-fsdtf6JC.js} +1 -1
- package/dist/{split-dcks18H1.js → split-eiktj-6L.js} +1 -1
- package/dist/{stack-lpJ5kYvE.js → stack-dfEEz2OY.js} +2 -2
- package/dist/{sum-CutF5lj2.js → sum-BE_Irnim.js} +1 -1
- package/dist/{tensor-C15NA2LA.js → tensor-Xyi595sG.js} +1 -1
- package/dist/{tensor2d-DZ_e5eKM.js → tensor2d-CPEkynbH.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 +5 -5
- 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/profile.d.ts +5 -0
- package/dist/utilities/profile.js +10 -7
- package/dist/utilities/safetensors.js +2 -2
- package/dist/utilities/save.js +1 -1
- package/dist/utilities/weights.js +2 -2
- package/dist/{variable-CdRKKp8x.js → variable-wSS22xj5.js} +1 -1
- package/dist/{zeros-CAbHfODe.js → zeros-YJDE7oRb.js} +4 -4
- package/package.json +2 -8
- package/dist/Reshape-CLOrdpve.js +0 -212
- package/dist/slice_util-Ddk0uxGJ.js +0 -49
- package/dist/tfjs_backend-BDb8r9qx.js +0 -1010
- package/dist/utilities/load.js +0 -99
package/dist/TeachableLLM.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { defaultConfig as
|
|
1
|
+
import { defaultConfig as d } from "./config.js";
|
|
2
2
|
import l from "./NanoGPTModel.js";
|
|
3
|
-
import { saveModel as
|
|
4
|
-
import { loadModel as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { E as
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
import
|
|
3
|
+
import { saveModel as f } from "./utilities/save.js";
|
|
4
|
+
import { loadModel as u } from "./loader/load.js";
|
|
5
|
+
import p from "./Generator.js";
|
|
6
|
+
import _ from "./Trainer.js";
|
|
7
|
+
import { E as c } from "./index-Dwqa6Zy2.js";
|
|
8
|
+
import { dummyPassTrainAsync as m } from "./utilities/dummy.js";
|
|
9
|
+
import g from "./tokeniser/CharTokeniser.js";
|
|
10
|
+
import w from "./tokeniser/bpe.js";
|
|
11
11
|
import "./papaparse.min-C8l2Kvo1.js";
|
|
12
12
|
import "./index-Tf7vU29b.js";
|
|
13
13
|
import "./jszip.min-CjP2V1VV.js";
|
|
14
|
-
import "./index-
|
|
14
|
+
import "./index-BAzbokzv.js";
|
|
15
15
|
import "./ops/cpu/scatterSub.js";
|
|
16
16
|
import "./ops/webgl/scatterSub.js";
|
|
17
17
|
import "./ops/cpu/gatherSub.js";
|
|
@@ -22,7 +22,9 @@ import "./ops/grads/attentionMask.js";
|
|
|
22
22
|
import "./ops/cpu/qkv.js";
|
|
23
23
|
import "./ops/webgl/qkv.js";
|
|
24
24
|
import "./ops/grads/qkv.js";
|
|
25
|
-
import "
|
|
25
|
+
import "./random_width-DWzaOgrn.js";
|
|
26
|
+
import "./register_all_kernels-BfFCQAqs.js";
|
|
27
|
+
import "./dataset-pgqp-YfL.js";
|
|
26
28
|
import "./ops/cpu/rope.js";
|
|
27
29
|
import "./ops/webgl/rope.js";
|
|
28
30
|
import "./ops/grads/rope.js";
|
|
@@ -41,13 +43,14 @@ import "./ops/cpu/normRMS.js";
|
|
|
41
43
|
import "./ops/webgl/normRMS.js";
|
|
42
44
|
import "./ops/grads/normRMS.js";
|
|
43
45
|
import "./ops/webgl/log.js";
|
|
44
|
-
import
|
|
46
|
+
import k from "./utilities/profile.js";
|
|
45
47
|
class a {
|
|
46
|
-
ee = new
|
|
48
|
+
ee = new c();
|
|
47
49
|
_config;
|
|
48
50
|
_model;
|
|
49
51
|
_tokeniser;
|
|
50
52
|
_status = "loading";
|
|
53
|
+
_memoryRequirements;
|
|
51
54
|
meta = {};
|
|
52
55
|
constructor(t, e) {
|
|
53
56
|
this._config = e?.config, this._tokeniser = t, this._model = e;
|
|
@@ -79,22 +82,26 @@ class a {
|
|
|
79
82
|
get ready() {
|
|
80
83
|
return this._status === "ready" && !!this._model && !!this._tokeniser && this.tokeniser.trained;
|
|
81
84
|
}
|
|
85
|
+
estimateTrainingMemoryUsage(t) {
|
|
86
|
+
const e = this._memoryRequirements ?? { perBatch: 0, gradients: 0 }, r = e.perBatch * t, o = e.gradients;
|
|
87
|
+
return r * 0.66 + o * 4;
|
|
88
|
+
}
|
|
82
89
|
setStatus(t) {
|
|
83
90
|
this._status !== t && (this._status = t, this.ee.emit("status", t));
|
|
84
91
|
}
|
|
85
92
|
saveModel(t) {
|
|
86
93
|
if (!this._model || !this._tokeniser)
|
|
87
94
|
throw new Error("Model or tokeniser is not initialized.");
|
|
88
|
-
return
|
|
95
|
+
return f(this._model, this._tokeniser, {
|
|
89
96
|
...t,
|
|
90
97
|
name: t?.name || this.meta.name
|
|
91
98
|
});
|
|
92
99
|
}
|
|
93
100
|
static loadModel(t) {
|
|
94
101
|
const e = new a();
|
|
95
|
-
return
|
|
96
|
-
e._model = r, e._tokeniser =
|
|
97
|
-
e.setStatus("ready"), e.ee.emit("loaded");
|
|
102
|
+
return u(t).then(({ model: r, tokeniser: o, name: s }) => {
|
|
103
|
+
e._model = r, e._tokeniser = o, e._config = r.config, s && (e.meta.name = s), e.setStatus("warmup"), m(r).then((i) => {
|
|
104
|
+
e._memoryRequirements = i, e.setStatus("ready"), e.ee.emit("loaded");
|
|
98
105
|
}).catch((i) => {
|
|
99
106
|
e.setStatus("error"), e.ee.emit("error", i);
|
|
100
107
|
});
|
|
@@ -103,10 +110,10 @@ class a {
|
|
|
103
110
|
}), e;
|
|
104
111
|
}
|
|
105
112
|
static create(t, e = {}) {
|
|
106
|
-
const r = { ...
|
|
107
|
-
return i.setStatus("warmup"), m(
|
|
108
|
-
i.tokeniser.trained ? (i.setStatus("ready"), i.ee.emit("loaded")) : (i.setStatus("awaitingTokens"), i.ee.emit("loaded"), i.tokeniser.once("trainStatus", (
|
|
109
|
-
|
|
113
|
+
const r = { ...d, ...e }, o = t === "char" ? new g(r.vocabSize) : new w(r.vocabSize), s = new l(r), i = new a(o, s);
|
|
114
|
+
return i.setStatus("warmup"), m(s).then((n) => {
|
|
115
|
+
i._memoryRequirements = n, i.tokeniser.trained ? (i.setStatus("ready"), i.ee.emit("loaded")) : (i.setStatus("awaitingTokens"), i.ee.emit("loaded"), i.tokeniser.once("trainStatus", (h) => {
|
|
116
|
+
h === "trained" && i.setStatus("ready");
|
|
110
117
|
}));
|
|
111
118
|
}).catch((n) => {
|
|
112
119
|
i.setStatus("error"), i.ee.emit("error", n);
|
|
@@ -122,7 +129,7 @@ class a {
|
|
|
122
129
|
if (t) {
|
|
123
130
|
if (!this._config)
|
|
124
131
|
throw new Error("Model is not initialized.");
|
|
125
|
-
this._config.layerConfig.profiler || (this._config.layerConfig.profiler = new
|
|
132
|
+
this._config.layerConfig.profiler || (this._config.layerConfig.profiler = new k());
|
|
126
133
|
} else
|
|
127
134
|
this._config?.layerConfig.profiler && (this._config.layerConfig.profiler = void 0);
|
|
128
135
|
}
|
|
@@ -134,11 +141,11 @@ class a {
|
|
|
134
141
|
trainer() {
|
|
135
142
|
if (!this._model || !this._tokeniser)
|
|
136
143
|
throw new Error("Model or tokeniser is not initialized.");
|
|
137
|
-
const t = new
|
|
144
|
+
const t = new _(this._model, this._tokeniser);
|
|
138
145
|
return t.on("start", () => this.setStatus("training")), t.on("stop", () => this.setStatus("ready")), t.on("log", async (e, r) => {
|
|
139
|
-
const
|
|
140
|
-
for (const
|
|
141
|
-
await
|
|
146
|
+
const o = this.ee.listeners("trainStep");
|
|
147
|
+
for (const s of o)
|
|
148
|
+
await s(e, r);
|
|
142
149
|
}), t;
|
|
143
150
|
}
|
|
144
151
|
train(t, e) {
|
|
@@ -153,7 +160,7 @@ class a {
|
|
|
153
160
|
generator() {
|
|
154
161
|
if (!this._model || !this._tokeniser)
|
|
155
162
|
throw new Error("model_or_tokeniser_not_initialized.");
|
|
156
|
-
const t = new
|
|
163
|
+
const t = new p(this._model, this._tokeniser);
|
|
157
164
|
return t.on("start", () => {
|
|
158
165
|
this.status === "ready" && this.setStatus("busy");
|
|
159
166
|
}), t.on("stop", () => {
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { R as a } from "./random_width-
|
|
2
|
-
import "./index-
|
|
3
|
-
import { d as s } from "./tfjs_backend-BDb8r9qx.js";
|
|
1
|
+
import { R as a, d as s } from "./random_width-DWzaOgrn.js";
|
|
2
|
+
import "./index-BAzbokzv.js";
|
|
4
3
|
import o from "./layers/BaseLayer.js";
|
|
5
|
-
import { v as m } from "./variable-
|
|
6
|
-
import { g as d } from "./gather-
|
|
4
|
+
import { v as m } from "./variable-wSS22xj5.js";
|
|
5
|
+
import { g as d } from "./gather-DjyCjmOD.js";
|
|
7
6
|
/**
|
|
8
7
|
* @license
|
|
9
8
|
* Copyright 2018 Google LLC
|
|
@@ -13,16 +12,16 @@ import { g as d } from "./gather-DZCMHZuN.js";
|
|
|
13
12
|
* https://opensource.org/licenses/MIT.
|
|
14
13
|
* =============================================================================
|
|
15
14
|
*/
|
|
16
|
-
function n(
|
|
17
|
-
return new a(
|
|
15
|
+
function n(i) {
|
|
16
|
+
return new a(i);
|
|
18
17
|
}
|
|
19
|
-
class
|
|
18
|
+
class S extends o {
|
|
20
19
|
vocabSize;
|
|
21
20
|
embedDim;
|
|
22
21
|
initializer;
|
|
23
22
|
WEIGHTS;
|
|
24
|
-
constructor(t,
|
|
25
|
-
super(t, r), this.WEIGHTS =
|
|
23
|
+
constructor(t, e, r) {
|
|
24
|
+
super(t, r), this.WEIGHTS = e, this.vocabSize = t.gpt.vocabSize, this.embedDim = t.gpt.nEmbed, this.initializer = n({
|
|
26
25
|
mean: 0,
|
|
27
26
|
stddev: 0.02
|
|
28
27
|
}), this.addVariable(this.WEIGHTS, m(this.initializer.apply([this.vocabSize, this.embedDim]), !0));
|
|
@@ -34,11 +33,11 @@ class c extends o {
|
|
|
34
33
|
return s(t, this.getVariable(this.WEIGHTS).transpose());
|
|
35
34
|
}
|
|
36
35
|
// Dummy, should not be used.
|
|
37
|
-
forward(t,
|
|
38
|
-
return this.project(
|
|
36
|
+
forward(t, e) {
|
|
37
|
+
return this.project(e);
|
|
39
38
|
}
|
|
40
39
|
}
|
|
41
40
|
export {
|
|
42
|
-
|
|
41
|
+
S as T,
|
|
43
42
|
n as r
|
|
44
43
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as c } from "./index-BAzbokzv.js";
|
|
2
2
|
/**
|
|
3
3
|
* @license
|
|
4
4
|
* Copyright 2017 Google LLC. All Rights Reserved.
|
|
@@ -21,28 +21,28 @@ function i(e, n) {
|
|
|
21
21
|
return !1;
|
|
22
22
|
return !0;
|
|
23
23
|
}
|
|
24
|
-
function
|
|
24
|
+
function a(e, n, t) {
|
|
25
25
|
const r = e.length + n.length, s = [];
|
|
26
26
|
let o = 0, f = 0;
|
|
27
27
|
for (let u = 0; u < r; u++)
|
|
28
28
|
t.indexOf(u) === -1 ? s.push(e[o++]) : s.push(n[f++]);
|
|
29
29
|
return s;
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function l(e, n) {
|
|
32
32
|
const t = [], r = e.length;
|
|
33
33
|
for (let o = 0; o < r; o++)
|
|
34
34
|
n.indexOf(o) === -1 && t.push(e[o]);
|
|
35
35
|
const s = n.map((o) => e[o]);
|
|
36
36
|
return [t, s];
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function h(e, n) {
|
|
39
39
|
const t = n.map((r) => 1);
|
|
40
|
-
return
|
|
40
|
+
return a(e, t, n);
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function m(e, n, t) {
|
|
43
43
|
c(i(n, t), () => `${e} supports only inner-most axes for now. Got axes ${n} and rank-${t} input.`);
|
|
44
44
|
}
|
|
45
|
-
function
|
|
45
|
+
function d(e, n) {
|
|
46
46
|
if (i(e, n))
|
|
47
47
|
return null;
|
|
48
48
|
const t = [];
|
|
@@ -61,9 +61,11 @@ function x(e, n) {
|
|
|
61
61
|
}
|
|
62
62
|
export {
|
|
63
63
|
x as a,
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
64
|
+
m as b,
|
|
65
|
+
l as c,
|
|
66
|
+
i as d,
|
|
67
|
+
h as e,
|
|
68
|
+
a as f,
|
|
69
|
+
d as g,
|
|
70
|
+
g as h
|
|
69
71
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { o as h,
|
|
2
|
-
import { r as T } from "./reshape-
|
|
1
|
+
import { o as h, q as f, x as p, H as g, E as u, I as b } from "./index-BAzbokzv.js";
|
|
2
|
+
import { r as T } from "./reshape-krWGKraP.js";
|
|
3
3
|
/**
|
|
4
4
|
* @license
|
|
5
5
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { o as s,
|
|
1
|
+
import { o as s, i as a, w as i, H as p, E as l, J as f } from "./index-BAzbokzv.js";
|
|
2
2
|
/**
|
|
3
3
|
* @license
|
|
4
4
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
@@ -17,13 +17,13 @@ import { o as s, l as a, k as p, y as i, E as l, C as f } from "./index-bMBtI-WR
|
|
|
17
17
|
*/
|
|
18
18
|
function h(o, e = 0) {
|
|
19
19
|
a(o.length >= 1, () => "Pass at least one tensor to concat");
|
|
20
|
-
const t =
|
|
20
|
+
const t = i(o, "tensors", "concat", "string_or_numeric");
|
|
21
21
|
if (t[0].dtype === "complex64" && t.forEach((n) => {
|
|
22
22
|
if (n.dtype !== "complex64")
|
|
23
23
|
throw new Error(`Cannot concatenate complex64 tensors with a tensor
|
|
24
24
|
with dtype ${n.dtype}. `);
|
|
25
25
|
}), t.length === 1)
|
|
26
|
-
return
|
|
26
|
+
return p(t[0]);
|
|
27
27
|
const r = t, c = { axis: e };
|
|
28
28
|
return l.runKernel(f, r, c);
|
|
29
29
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ab as S, T as h, ac as N, d as v, ad as o, ae as p, af as g, i as k, t as y } from "./index-BAzbokzv.js";
|
|
2
2
|
import { s as R } from "./index-C4L8Cm77.js";
|
|
3
|
-
import { s as $ } from "./stack-
|
|
4
|
-
import { t as B } from "./tensor-
|
|
3
|
+
import { s as $ } from "./stack-dfEEz2OY.js";
|
|
4
|
+
import { t as B } from "./tensor-Xyi595sG.js";
|
|
5
5
|
/**
|
|
6
6
|
* @license
|
|
7
7
|
* Copyright 2018 Google LLC. All Rights Reserved.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { o as l,
|
|
1
|
+
import { o as l, q as h, E as m, ag as p, x as c, ah as d, ai as g, i as u, T as V, aj as v, a7 as N, a as w } from "./index-BAzbokzv.js";
|
|
2
2
|
import { s as f } from "./index-C4L8Cm77.js";
|
|
3
3
|
/**
|
|
4
4
|
* @license
|
|
@@ -16,11 +16,11 @@ import { s as f } from "./index-C4L8Cm77.js";
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
* =============================================================================
|
|
18
18
|
*/
|
|
19
|
-
function
|
|
19
|
+
function x(r) {
|
|
20
20
|
const e = { x: h(r, "x", "floor", "float32") };
|
|
21
21
|
return m.runKernel(p, e);
|
|
22
22
|
}
|
|
23
|
-
const
|
|
23
|
+
const b = /* @__PURE__ */ l({ floor_: x });
|
|
24
24
|
/**
|
|
25
25
|
* @license
|
|
26
26
|
* Copyright 2018 Google LLC. All Rights Reserved.
|
|
@@ -180,14 +180,14 @@ function R(r, t, e, s) {
|
|
|
180
180
|
const n = h(r, "x", "dropout");
|
|
181
181
|
if (u(n.dtype === "float32", () => `x has to be a floating point tensor since it's going to be scaled, but got a ${n.dtype} tensor instead.`), u(t >= 0 && t < 1, () => `rate must be a float in the range [0, 1), but got ${t}.`), t === 0)
|
|
182
182
|
return r instanceof V ? n.clone() : n;
|
|
183
|
-
const o = E(n, e), a = 1 - t, i = v(
|
|
183
|
+
const o = E(n, e), a = 1 - t, i = v(b(N(D(o, 0, 1, "float32", s), a)), a);
|
|
184
184
|
return w(n, i);
|
|
185
185
|
}
|
|
186
|
-
const
|
|
186
|
+
const q = /* @__PURE__ */ l({ dropout_: R });
|
|
187
187
|
export {
|
|
188
188
|
T as M,
|
|
189
189
|
D as a,
|
|
190
|
-
|
|
191
|
-
|
|
190
|
+
q as d,
|
|
191
|
+
b as f,
|
|
192
192
|
_ as r
|
|
193
193
|
};
|