@genai-fi/nanogpt 0.6.0 → 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.
Files changed (110) hide show
  1. package/dist/Generator.js +7 -7
  2. package/dist/NanoGPTModel.js +70 -121
  3. package/dist/RealDiv-7xu-pkZN.js +540 -0
  4. package/dist/Reshape-BYC1oUku.js +127 -0
  5. package/dist/TeachableLLM.d.ts +2 -0
  6. package/dist/TeachableLLM.js +34 -27
  7. package/dist/{TiedEmbedding-BhxWO8QR.js → TiedEmbedding-C1HBot-5.js} +12 -13
  8. package/dist/{axis_util-D17qZRQm.js → axis_util-CCNL7jea.js} +14 -12
  9. package/dist/{broadcast_to-BMQLjvt_.js → broadcast_to-CddAF879.js} +2 -2
  10. package/dist/{concat-DhZfF1GY.js → concat-XOK9ANZu.js} +7 -7
  11. package/dist/{dataset-oilnemHf.js → dataset-BFFipD1c.js} +5 -5
  12. package/dist/{dropout-CrMQPCeG.js → dropout-xlKRoJyU.js} +9 -9
  13. package/dist/{gather-DZCMHZuN.js → gather-DKtUaTtA.js} +1 -1
  14. package/dist/gpgpu_math-B_ycgZ4W.js +3115 -0
  15. package/dist/{index-bMBtI-WR.js → index-CamYe_M8.js} +843 -646
  16. package/dist/{kernel_funcs_utils-CNmjLWnB.js → kernel_funcs_utils-D5MS0JFg.js} +232 -138
  17. package/dist/layers/BaseLayer.js +2 -2
  18. package/dist/layers/CausalSelfAttention.js +6 -6
  19. package/dist/layers/MLP.js +5 -5
  20. package/dist/layers/RMSNorm.js +3 -3
  21. package/dist/layers/RoPECache.js +13 -33
  22. package/dist/layers/TiedEmbedding.js +6 -7
  23. package/dist/layers/TransformerBlock.js +1 -1
  24. package/dist/{log_sum_exp-BHdkCb4s.js → log_sum_exp-CV_5-TTu.js} +15 -15
  25. package/dist/main.js +23 -20
  26. package/dist/{mat_mul-BsrLfy81.js → mat_mul-CAbRFWUj.js} +4 -4
  27. package/dist/{max-DechV4Bc.js → max-JBBv7aUf.js} +3 -3
  28. package/dist/mulmat_packed_gpu-DW4doKL_.js +71 -0
  29. package/dist/{norm-B9hWHZH1.js → norm-B9dQTFYn.js} +12 -12
  30. package/dist/{ones-g0K8jVwm.js → ones-CMHNqMr6.js} +2 -2
  31. package/dist/ops/appendCache.js +3 -3
  32. package/dist/ops/attentionMask.js +1 -1
  33. package/dist/ops/cpu/appendCache.js +2 -2
  34. package/dist/ops/cpu/attentionMask.js +5 -5
  35. package/dist/ops/cpu/fusedSoftmax.js +2 -2
  36. package/dist/ops/cpu/gatherSub.js +5 -5
  37. package/dist/ops/cpu/gelu.js +1 -1
  38. package/dist/ops/cpu/matMulGelu.js +1 -1
  39. package/dist/ops/cpu/matMulMul.js +1 -1
  40. package/dist/ops/cpu/mulDropout.js +1 -1
  41. package/dist/ops/cpu/normRMS.js +1 -1
  42. package/dist/ops/cpu/qkv.js +3 -3
  43. package/dist/ops/cpu/rope.js +5 -5
  44. package/dist/ops/cpu/scatterSub.js +18 -49
  45. package/dist/ops/fusedSoftmax.js +1 -1
  46. package/dist/ops/gatherSub.js +1 -1
  47. package/dist/ops/gelu.js +1 -1
  48. package/dist/ops/grads/attentionMask.js +1 -1
  49. package/dist/ops/grads/fusedSoftmax.js +2 -2
  50. package/dist/ops/grads/gelu.js +1 -1
  51. package/dist/ops/grads/matMulGelu.js +1 -1
  52. package/dist/ops/grads/normRMS.js +1 -1
  53. package/dist/ops/grads/qkv.js +1 -1
  54. package/dist/ops/grads/rope.js +1 -1
  55. package/dist/ops/matMulGelu.js +1 -1
  56. package/dist/ops/matMulMul.js +1 -1
  57. package/dist/ops/mulDrop.js +1 -1
  58. package/dist/ops/node/sparseCrossEntropy.js +1 -1
  59. package/dist/ops/normRMS.js +1 -1
  60. package/dist/ops/qkv.js +1 -1
  61. package/dist/ops/rope.js +8 -4
  62. package/dist/ops/scatterSub.js +1 -1
  63. package/dist/ops/webgl/appendCache.js +1 -1
  64. package/dist/ops/webgl/attentionMask.js +1 -1
  65. package/dist/ops/webgl/fusedSoftmax.js +29 -560
  66. package/dist/ops/webgl/gatherSub.js +1 -1
  67. package/dist/ops/webgl/gelu.js +2 -2
  68. package/dist/ops/webgl/log.js +3 -3
  69. package/dist/ops/webgl/matMulGelu.js +48 -115
  70. package/dist/ops/webgl/matMulMul.js +1 -1
  71. package/dist/ops/webgl/mulDropout.js +1 -1
  72. package/dist/ops/webgl/normRMS.js +2 -2
  73. package/dist/ops/webgl/qkv.js +1 -1
  74. package/dist/ops/webgl/rope.js +1 -1
  75. package/dist/ops/webgl/scatterSub.js +1 -1
  76. package/dist/{ops-Mv7Ta72x.js → ops-DqtYemmV.js} +143 -135
  77. package/dist/{random_width-BBAWzDym.js → random_width-CLMQG5Jn.js} +6925 -6291
  78. package/dist/{range-DMaG9A3G.js → range-DqYjKnuG.js} +1 -1
  79. package/dist/{gpgpu_math-Ctc31slO.js → reciprocal-z49filta.js} +7 -5
  80. package/dist/register_all_kernels-COt6wLD0.js +21397 -0
  81. package/dist/{reshape-T4yDEqoF.js → reshape-C45vIIRU.js} +1 -1
  82. package/dist/scatter_nd_util-qgtnviTE.js +46 -0
  83. package/dist/selu_util-4QV_GXTB.js +740 -0
  84. package/dist/{shared-XNAoXhOa.js → shared-ByfrGA97.js} +1462 -1089
  85. package/dist/{sin-EEhbrRO_.js → sin-9JBrfVaB.js} +1 -1
  86. package/dist/{softmax-B2_IKPDR.js → softmax-DvMvui-_.js} +1 -1
  87. package/dist/{split-dcks18H1.js → split-DxrHrPFK.js} +4 -4
  88. package/dist/{stack-lpJ5kYvE.js → stack-DgaoDmnF.js} +1 -1
  89. package/dist/{sum-CutF5lj2.js → sum-BpcpxNEh.js} +3 -3
  90. package/dist/{tensor-C15NA2LA.js → tensor-CDz5x1mP.js} +1 -1
  91. package/dist/{tensor2d-DZ_e5eKM.js → tensor2d-jO8JY5Jd.js} +1 -1
  92. package/dist/training/AdamExt.js +1 -1
  93. package/dist/training/DatasetBuilder.js +2 -2
  94. package/dist/training/FullTrainer.js +1 -1
  95. package/dist/training/Trainer.js +3 -3
  96. package/dist/training/sparseCrossEntropy.js +4 -4
  97. package/dist/utilities/dummy.d.ts +6 -0
  98. package/dist/utilities/dummy.js +31 -10
  99. package/dist/utilities/generate.js +3 -3
  100. package/dist/utilities/load.js +1 -1
  101. package/dist/utilities/profile.d.ts +5 -0
  102. package/dist/utilities/profile.js +10 -7
  103. package/dist/utilities/safetensors.js +2 -2
  104. package/dist/utilities/weights.js +2 -2
  105. package/dist/{variable-CdRKKp8x.js → variable-CLVXjN7F.js} +1 -1
  106. package/dist/{zeros-CAbHfODe.js → zeros-DUkkVccu.js} +8 -8
  107. package/package.json +3 -9
  108. package/dist/Reshape-CLOrdpve.js +0 -212
  109. package/dist/slice_util-Ddk0uxGJ.js +0 -49
  110. package/dist/tfjs_backend-BDb8r9qx.js +0 -1010
@@ -1,17 +1,17 @@
1
- import { defaultConfig as h } from "./config.js";
1
+ import { defaultConfig as d } from "./config.js";
2
2
  import l from "./NanoGPTModel.js";
3
- import { saveModel as d } from "./utilities/save.js";
4
- import { loadModel as f } from "./utilities/load.js";
5
- import u from "./Generator.js";
6
- import p from "./Trainer.js";
7
- import { E as _ } from "./index-Dwqa6Zy2.js";
8
- import { dummyPassAsync as m } from "./utilities/dummy.js";
9
- import c from "./tokeniser/CharTokeniser.js";
10
- import g from "./tokeniser/bpe.js";
3
+ import { saveModel as f } from "./utilities/save.js";
4
+ import { loadModel as u } from "./utilities/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-bMBtI-WR.js";
14
+ import "./index-CamYe_M8.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 "@tensorflow/tfjs";
25
+ import "./random_width-CLMQG5Jn.js";
26
+ import "./register_all_kernels-COt6wLD0.js";
27
+ import "./dataset-BFFipD1c.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 w from "./utilities/profile.js";
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 d(this._model, this._tokeniser, {
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 f(t).then(({ model: r, tokeniser: s, name: o }) => {
96
- e._model = r, e._tokeniser = s, e._config = r.config, o && (e.meta.name = o), e.setStatus("warmup"), m(r).then(() => {
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 = { ...h, ...e }, s = t === "char" ? new c(r.vocabSize) : new g(r.vocabSize), o = new l(r), i = new a(s, o);
107
- return i.setStatus("warmup"), m(o).then(() => {
108
- i.tokeniser.trained ? (i.setStatus("ready"), i.ee.emit("loaded")) : (i.setStatus("awaitingTokens"), i.ee.emit("loaded"), i.tokeniser.once("trainStatus", (n) => {
109
- n === "trained" && i.setStatus("ready");
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 w());
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 p(this._model, this._tokeniser);
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 s = this.ee.listeners("trainStep");
140
- for (const o of s)
141
- await o(e, r);
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 u(this._model, this._tokeniser);
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-BBAWzDym.js";
2
- import "./index-bMBtI-WR.js";
3
- import { d as s } from "./tfjs_backend-BDb8r9qx.js";
1
+ import { R as a, d as s } from "./random_width-CLMQG5Jn.js";
2
+ import "./index-CamYe_M8.js";
4
3
  import o from "./layers/BaseLayer.js";
5
- import { v as m } from "./variable-CdRKKp8x.js";
6
- import { g as d } from "./gather-DZCMHZuN.js";
4
+ import { v as m } from "./variable-CLVXjN7F.js";
5
+ import { g as d } from "./gather-DKtUaTtA.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(e) {
17
- return new a(e);
15
+ function n(i) {
16
+ return new a(i);
18
17
  }
19
- class c extends o {
18
+ class S extends o {
20
19
  vocabSize;
21
20
  embedDim;
22
21
  initializer;
23
22
  WEIGHTS;
24
- constructor(t, i, r) {
25
- super(t, r), this.WEIGHTS = i, this.vocabSize = t.gpt.vocabSize, this.embedDim = t.gpt.nEmbed, this.initializer = n({
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, i) {
38
- return this.project(i);
36
+ forward(t, e) {
37
+ return this.project(e);
39
38
  }
40
39
  }
41
40
  export {
42
- c as T,
41
+ S as T,
43
42
  n as r
44
43
  };
@@ -1,4 +1,4 @@
1
- import { l as c } from "./index-bMBtI-WR.js";
1
+ import { k as c } from "./index-CamYe_M8.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 l(e, n, t) {
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 a(e, n) {
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 m(e, n) {
38
+ function h(e, n) {
39
39
  const t = n.map((r) => 1);
40
- return l(e, t, n);
40
+ return a(e, t, n);
41
41
  }
42
- function d(e, n, t) {
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 h(e, n) {
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
- d as b,
65
- a as c,
66
- g as d,
67
- m as e,
68
- h as g
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, j as f, n as p, y as g, E as u, L as b } from "./index-bMBtI-WR.js";
2
- import { r as T } from "./reshape-T4yDEqoF.js";
1
+ import { q as h, w as f, y as p, I as g, E as u, J as b } from "./index-CamYe_M8.js";
2
+ import { r as T } from "./reshape-C45vIIRU.js";
3
3
  /**
4
4
  * @license
5
5
  * Copyright 2020 Google LLC. All Rights Reserved.
@@ -1,4 +1,4 @@
1
- import { o as s, l as a, k as p, y as i, E as l, C as f } from "./index-bMBtI-WR.js";
1
+ import { q as s, k as a, x as p, I as i, E as l, K as f } from "./index-CamYe_M8.js";
2
2
  /**
3
3
  * @license
4
4
  * Copyright 2020 Google LLC. All Rights Reserved.
@@ -15,13 +15,13 @@ import { o as s, l as a, k as p, y as i, E as l, C as f } from "./index-bMBtI-WR
15
15
  * limitations under the License.
16
16
  * =============================================================================
17
17
  */
18
- function h(o, e = 0) {
19
- a(o.length >= 1, () => "Pass at least one tensor to concat");
20
- const t = p(o, "tensors", "concat", "string_or_numeric");
21
- if (t[0].dtype === "complex64" && t.forEach((n) => {
22
- if (n.dtype !== "complex64")
18
+ function h(n, e = 0) {
19
+ a(n.length >= 1, () => "Pass at least one tensor to concat");
20
+ const t = p(n, "tensors", "concat", "string_or_numeric");
21
+ if (t[0].dtype === "complex64" && t.forEach((o) => {
22
+ if (o.dtype !== "complex64")
23
23
  throw new Error(`Cannot concatenate complex64 tensors with a tensor
24
- with dtype ${n.dtype}. `);
24
+ with dtype ${o.dtype}. `);
25
25
  }), t.length === 1)
26
26
  return i(t[0]);
27
27
  const r = t, c = { axis: e };
@@ -1,7 +1,7 @@
1
- import { af as S, T as h, N, a as v, ag as o, ah as p, ai as g, l as k, t as y } from "./index-bMBtI-WR.js";
1
+ import { ab as S, T as h, ac as k, a as v, ad as o, ae as p, af as g, k as N, t as y } from "./index-CamYe_M8.js";
2
2
  import { s as R } from "./index-C4L8Cm77.js";
3
- import { s as $ } from "./stack-lpJ5kYvE.js";
4
- import { t as B } from "./tensor-C15NA2LA.js";
3
+ import { s as $ } from "./stack-DgaoDmnF.js";
4
+ import { t as B } from "./tensor-CDz5x1mP.js";
5
5
  /**
6
6
  * @license
7
7
  * Copyright 2018 Google LLC. All Rights Reserved.
@@ -75,7 +75,7 @@ function I(s) {
75
75
  }
76
76
  function c(s) {
77
77
  let t = !1;
78
- if (N().get("IS_BROWSER"))
78
+ if (k().get("IS_BROWSER"))
79
79
  t = s instanceof TextDecoder;
80
80
  else {
81
81
  const { StringDecoder: e } = require("string_decoder");
@@ -930,7 +930,7 @@ class T {
930
930
  */
931
931
  batch(t, e = !0) {
932
932
  const r = this;
933
- k(t > 0, () => `batchSize needs to be positive, but it is
933
+ N(t > 0, () => `batchSize needs to be positive, but it is
934
934
  ${t}`);
935
935
  let n;
936
936
  return this.size === 1 / 0 || this.size == null ? n = this.size : e ? n = Math.ceil(this.size / t) : n = Math.floor(this.size / t), u(async () => (await r.iterator()).columnMajorBatch(t, e, st), n);
@@ -1,4 +1,4 @@
1
- import { o as l, j as h, E as m, aj as p, n as c, ak as d, ad as g, l as u, T as V, al as v, a8 as N, b as w } from "./index-bMBtI-WR.js";
1
+ import { q as l, w as h, E as m, ag as p, y as c, ah as d, ai as g, k as u, T as V, aj as v, a7 as w, b as N } from "./index-CamYe_M8.js";
2
2
  import { s as f } from "./index-C4L8Cm77.js";
3
3
  /**
4
4
  * @license
@@ -69,7 +69,7 @@ class T {
69
69
  return t <= this.upper && t >= this.lower;
70
70
  }
71
71
  }
72
- class $ {
72
+ class y {
73
73
  constructor(t = 0, e = 1, s, n) {
74
74
  if (this.canReturnFloat = () => this.dtype == null || this.dtype === "float32", this.min = t, this.range = e - t, this.dtype = s, n == null && (n = Math.random()), typeof n == "number" && (n = n.toString()), !this.canReturnFloat() && this.range <= 1)
75
75
  throw new Error(`The difference between ${t} - ${e} <= 1 and dtype is not float`);
@@ -98,7 +98,7 @@ class $ {
98
98
  * limitations under the License.
99
99
  * =============================================================================
100
100
  */
101
- function y(r, t = 0, e = 1, s, n) {
101
+ function $(r, t = 0, e = 1, s, n) {
102
102
  if (c(r), s != null && s === "bool")
103
103
  throw new Error(`Unsupported data type ${s}`);
104
104
  const o = new T(t, e, s, !1, n), a = d(r, s);
@@ -106,7 +106,7 @@ function y(r, t = 0, e = 1, s, n) {
106
106
  a.values[i] = o.nextValue();
107
107
  return a.toTensor();
108
108
  }
109
- const _ = /* @__PURE__ */ l({ randomNormal_: y });
109
+ const _ = /* @__PURE__ */ l({ randomNormal_: $ });
110
110
  /**
111
111
  * @license
112
112
  * Copyright 2020 Google LLC. All Rights Reserved.
@@ -125,7 +125,7 @@ const _ = /* @__PURE__ */ l({ randomNormal_: y });
125
125
  */
126
126
  function M(r, t = 0, e = 1, s = "float32", n) {
127
127
  c(r);
128
- const o = d(r, s), a = new $(t, e, null, n);
128
+ const o = d(r, s), a = new y(t, e, null, n);
129
129
  for (let i = 0; i < o.values.length; i++)
130
130
  o.values[i] = a.nextValue();
131
131
  return o.toTensor();
@@ -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(x(N(D(o, 0, 1, "float32", s), a)), a);
184
- return w(n, i);
183
+ const o = E(n, e), a = 1 - t, i = v(x(w(D(o, 0, 1, "float32", s), a)), a);
184
+ return N(n, i);
185
185
  }
186
- const G = /* @__PURE__ */ l({ dropout_: R });
186
+ const q = /* @__PURE__ */ l({ dropout_: R });
187
187
  export {
188
188
  T as M,
189
189
  D as a,
190
- G as d,
190
+ q as d,
191
191
  x as f,
192
192
  _ as r
193
193
  };
@@ -1,4 +1,4 @@
1
- import { o as g, j as t, E as h, G as p } from "./index-bMBtI-WR.js";
1
+ import { q as g, w as t, E as h, G as p } from "./index-CamYe_M8.js";
2
2
  /**
3
3
  * @license
4
4
  * Copyright 2018 Google LLC. All Rights Reserved.