deepbox 0.1.0 → 0.2.0

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 (165) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +39 -37
  3. package/dist/{CSRMatrix-KzNt6QpS.d.ts → CSRMatrix-B7XtUAZO.d.cts} +3 -3
  4. package/dist/{CSRMatrix-CwGwQRea.d.cts → CSRMatrix-CtD23fRM.d.ts} +3 -3
  5. package/dist/{Tensor-BQLk1ltW.d.cts → Tensor-BORFp_zt.d.ts} +27 -7
  6. package/dist/{Tensor-g8mUClel.d.ts → Tensor-fxBg-TFZ.d.cts} +27 -7
  7. package/dist/{chunk-FJYLIGJX.js → chunk-3AX37GPK.js} +33 -7
  8. package/dist/chunk-3AX37GPK.js.map +1 -0
  9. package/dist/{chunk-PR647I7R.js → chunk-3YFEYDHN.js} +21 -4
  10. package/dist/chunk-3YFEYDHN.js.map +1 -0
  11. package/dist/{chunk-XMWVME2W.js → chunk-6SX26MAJ.js} +4 -4
  12. package/dist/{chunk-XMWVME2W.js.map → chunk-6SX26MAJ.js.map} +1 -1
  13. package/dist/{chunk-C4PKXY74.cjs → chunk-6X7XFNDO.cjs} +94 -77
  14. package/dist/chunk-6X7XFNDO.cjs.map +1 -0
  15. package/dist/{chunk-6AE5FKKQ.cjs → chunk-724CXHFH.cjs} +1211 -919
  16. package/dist/chunk-724CXHFH.cjs.map +1 -0
  17. package/dist/{chunk-AU7XHGKJ.js → chunk-AJTKVBY5.js} +4 -4
  18. package/dist/{chunk-AU7XHGKJ.js.map → chunk-AJTKVBY5.js.map} +1 -1
  19. package/dist/{chunk-ZB75FESB.cjs → chunk-AV6WGSYX.cjs} +130 -104
  20. package/dist/chunk-AV6WGSYX.cjs.map +1 -0
  21. package/dist/{chunk-ZLW62TJG.cjs → chunk-BWOSU234.cjs} +142 -141
  22. package/dist/chunk-BWOSU234.cjs.map +1 -0
  23. package/dist/{chunk-4S73VUBD.js → chunk-CZOMBUI7.js} +3 -3
  24. package/dist/chunk-CZOMBUI7.js.map +1 -0
  25. package/dist/{chunk-QERHVCHC.cjs → chunk-EUZHJDZ6.cjs} +419 -364
  26. package/dist/chunk-EUZHJDZ6.cjs.map +1 -0
  27. package/dist/{chunk-AD436M45.js → chunk-G2G55ATL.js} +120 -58
  28. package/dist/chunk-G2G55ATL.js.map +1 -0
  29. package/dist/{chunk-5R4S63PF.js → chunk-G3WNLNYS.js} +119 -64
  30. package/dist/chunk-G3WNLNYS.js.map +1 -0
  31. package/dist/{chunk-XEG44RF6.cjs → chunk-G7KXZHG6.cjs} +105 -95
  32. package/dist/chunk-G7KXZHG6.cjs.map +1 -0
  33. package/dist/{chunk-MLBMYKCG.js → chunk-H3JR7SV2.js} +255 -113
  34. package/dist/chunk-H3JR7SV2.js.map +1 -0
  35. package/dist/{chunk-PHV2DKRS.cjs → chunk-HDKMIG6E.cjs} +107 -107
  36. package/dist/{chunk-PHV2DKRS.cjs.map → chunk-HDKMIG6E.cjs.map} +1 -1
  37. package/dist/{chunk-ALS7ETWZ.cjs → chunk-HI2EZHCJ.cjs} +111 -102
  38. package/dist/chunk-HI2EZHCJ.cjs.map +1 -0
  39. package/dist/{chunk-OX6QXFMV.cjs → chunk-IT4BZUYE.cjs} +490 -428
  40. package/dist/chunk-IT4BZUYE.cjs.map +1 -0
  41. package/dist/{chunk-E3EU5FZO.cjs → chunk-JTZPRV6E.cjs} +123 -123
  42. package/dist/{chunk-E3EU5FZO.cjs.map → chunk-JTZPRV6E.cjs.map} +1 -1
  43. package/dist/{chunk-PL7TAYKI.js → chunk-K2L5C5YH.js} +8 -7
  44. package/dist/chunk-K2L5C5YH.js.map +1 -0
  45. package/dist/{chunk-BCR7G3A6.js → chunk-KCF6P34A.js} +356 -64
  46. package/dist/chunk-KCF6P34A.js.map +1 -0
  47. package/dist/{chunk-ZXKBDFP3.js → chunk-LZHVHD62.js} +15 -6
  48. package/dist/chunk-LZHVHD62.js.map +1 -0
  49. package/dist/{chunk-LWECRCW2.cjs → chunk-MTJF52AJ.cjs} +141 -141
  50. package/dist/{chunk-LWECRCW2.cjs.map → chunk-MTJF52AJ.cjs.map} +1 -1
  51. package/dist/{chunk-B5TNKUEY.js → chunk-NDDTUFKK.js} +16 -6
  52. package/dist/chunk-NDDTUFKK.js.map +1 -0
  53. package/dist/{chunk-DWZY6PIP.cjs → chunk-NOQI6OFL.cjs} +615 -473
  54. package/dist/chunk-NOQI6OFL.cjs.map +1 -0
  55. package/dist/{chunk-F3JWBINJ.js → chunk-OEXDJFHA.js} +4 -4
  56. package/dist/{chunk-F3JWBINJ.js.map → chunk-OEXDJFHA.js.map} +1 -1
  57. package/dist/{chunk-JSCDE774.cjs → chunk-Z6BGACIH.cjs} +3 -3
  58. package/dist/chunk-Z6BGACIH.cjs.map +1 -0
  59. package/dist/core/index.cjs +50 -50
  60. package/dist/core/index.d.cts +2 -2
  61. package/dist/core/index.d.ts +2 -2
  62. package/dist/core/index.js +1 -1
  63. package/dist/dataframe/index.cjs +6 -6
  64. package/dist/dataframe/index.d.cts +3 -3
  65. package/dist/dataframe/index.d.ts +3 -3
  66. package/dist/dataframe/index.js +3 -3
  67. package/dist/datasets/index.cjs +34 -34
  68. package/dist/datasets/index.d.cts +3 -3
  69. package/dist/datasets/index.d.ts +3 -3
  70. package/dist/datasets/index.js +3 -3
  71. package/dist/{index-C1mfVYoo.d.ts → index-B18dHc8q.d.ts} +81 -46
  72. package/dist/{index-GFAVyOWO.d.ts → index-BHHX0qTY.d.cts} +14 -12
  73. package/dist/{index-tk4lSYod.d.ts → index-BI6QOUvV.d.ts} +106 -80
  74. package/dist/{index-DIp_RrRt.d.ts → index-BKvK21lf.d.ts} +13 -35
  75. package/dist/{index-BJY2SI4i.d.ts → index-BL8jLf3K.d.cts} +12 -11
  76. package/dist/{index-Cn3SdB0O.d.ts → index-BNbX167d.d.cts} +16 -10
  77. package/dist/{index-BWGhrDlr.d.ts → index-BT2ofL7Z.d.cts} +35 -35
  78. package/dist/{index-BbA2Gxfl.d.ts → index-BqcfIcL4.d.ts} +15 -15
  79. package/dist/{index-ZtI1Iy4L.d.ts → index-BrgrECM2.d.ts} +41 -38
  80. package/dist/{index-CDw5CnOU.d.ts → index-BtYKI9yJ.d.ts} +10 -8
  81. package/dist/{index-DIT_OO9C.d.cts → index-C7nLsAOC.d.cts} +10 -8
  82. package/dist/{index-D9Loo1_A.d.cts → index-CNj2Mxwf.d.cts} +81 -46
  83. package/dist/{index-DmEg_LCm.d.cts → index-CYlxeNW1.d.cts} +5 -3
  84. package/dist/{index-D61yaSMY.d.cts → index-CiTd61a5.d.ts} +12 -11
  85. package/dist/{index-BndMbqsM.d.ts → index-Cjnn0KeN.d.cts} +35 -21
  86. package/dist/{index-9oQx1HgV.d.cts → index-CkGGAn69.d.cts} +41 -38
  87. package/dist/{index-74AB8Cyh.d.cts → index-D4URSgqA.d.ts} +16 -10
  88. package/dist/{index-DoPWVxPo.d.cts → index-D4pn5zLT.d.ts} +35 -21
  89. package/dist/{index-DuCxd-8d.d.ts → index-D9ztTlDr.d.ts} +60 -42
  90. package/dist/{index-BgHYAoSS.d.cts → index-DF28ZPB5.d.cts} +60 -42
  91. package/dist/{index-eJgeni9c.d.cts → index-DLdiQzf0.d.cts} +106 -80
  92. package/dist/{index-WHQLn0e8.d.cts → index-DN4omPQw.d.ts} +35 -35
  93. package/dist/{index-CrqLlS-a.d.ts → index-DUnFq1WV.d.ts} +5 -3
  94. package/dist/{index-DbultU6X.d.cts → index-DgaYshkF.d.ts} +14 -12
  95. package/dist/{index-B_DK4FKY.d.cts → index-GUHYEhxs.d.cts} +13 -35
  96. package/dist/{index-CCvlwAmL.d.cts → index-TP--4irE.d.cts} +16 -14
  97. package/dist/{index-Dx42TZaY.d.ts → index-x0z_sanT.d.ts} +16 -14
  98. package/dist/{index-DyZ4QQf5.d.cts → index-xWH7ujWa.d.cts} +15 -15
  99. package/dist/index.cjs +26 -26
  100. package/dist/index.d.cts +17 -17
  101. package/dist/index.d.ts +17 -17
  102. package/dist/index.js +13 -13
  103. package/dist/linalg/index.cjs +22 -22
  104. package/dist/linalg/index.d.cts +3 -3
  105. package/dist/linalg/index.d.ts +3 -3
  106. package/dist/linalg/index.js +3 -3
  107. package/dist/metrics/index.cjs +40 -40
  108. package/dist/metrics/index.d.cts +3 -3
  109. package/dist/metrics/index.d.ts +3 -3
  110. package/dist/metrics/index.js +3 -3
  111. package/dist/ml/index.cjs +23 -23
  112. package/dist/ml/index.d.cts +3 -3
  113. package/dist/ml/index.d.ts +3 -3
  114. package/dist/ml/index.js +4 -4
  115. package/dist/ndarray/index.cjs +125 -125
  116. package/dist/ndarray/index.d.cts +5 -5
  117. package/dist/ndarray/index.d.ts +5 -5
  118. package/dist/ndarray/index.js +2 -2
  119. package/dist/nn/index.cjs +36 -36
  120. package/dist/nn/index.d.cts +6 -6
  121. package/dist/nn/index.d.ts +6 -6
  122. package/dist/nn/index.js +3 -3
  123. package/dist/optim/index.cjs +19 -19
  124. package/dist/optim/index.d.cts +4 -4
  125. package/dist/optim/index.d.ts +4 -4
  126. package/dist/optim/index.js +2 -2
  127. package/dist/plot/index.cjs +29 -29
  128. package/dist/plot/index.d.cts +6 -6
  129. package/dist/plot/index.d.ts +6 -6
  130. package/dist/plot/index.js +3 -3
  131. package/dist/preprocess/index.cjs +21 -21
  132. package/dist/preprocess/index.d.cts +4 -4
  133. package/dist/preprocess/index.d.ts +4 -4
  134. package/dist/preprocess/index.js +3 -3
  135. package/dist/random/index.cjs +19 -19
  136. package/dist/random/index.d.cts +3 -3
  137. package/dist/random/index.d.ts +3 -3
  138. package/dist/random/index.js +3 -3
  139. package/dist/stats/index.cjs +36 -36
  140. package/dist/stats/index.d.cts +3 -3
  141. package/dist/stats/index.d.ts +3 -3
  142. package/dist/stats/index.js +3 -3
  143. package/dist/{tensor-B96jjJLQ.d.cts → tensor-IlVTF0bz.d.cts} +16 -3
  144. package/dist/{tensor-B96jjJLQ.d.ts → tensor-IlVTF0bz.d.ts} +16 -3
  145. package/package.json +3 -2
  146. package/dist/chunk-4S73VUBD.js.map +0 -1
  147. package/dist/chunk-5R4S63PF.js.map +0 -1
  148. package/dist/chunk-6AE5FKKQ.cjs.map +0 -1
  149. package/dist/chunk-AD436M45.js.map +0 -1
  150. package/dist/chunk-ALS7ETWZ.cjs.map +0 -1
  151. package/dist/chunk-B5TNKUEY.js.map +0 -1
  152. package/dist/chunk-BCR7G3A6.js.map +0 -1
  153. package/dist/chunk-C4PKXY74.cjs.map +0 -1
  154. package/dist/chunk-DWZY6PIP.cjs.map +0 -1
  155. package/dist/chunk-FJYLIGJX.js.map +0 -1
  156. package/dist/chunk-JSCDE774.cjs.map +0 -1
  157. package/dist/chunk-MLBMYKCG.js.map +0 -1
  158. package/dist/chunk-OX6QXFMV.cjs.map +0 -1
  159. package/dist/chunk-PL7TAYKI.js.map +0 -1
  160. package/dist/chunk-PR647I7R.js.map +0 -1
  161. package/dist/chunk-QERHVCHC.cjs.map +0 -1
  162. package/dist/chunk-XEG44RF6.cjs.map +0 -1
  163. package/dist/chunk-ZB75FESB.cjs.map +0 -1
  164. package/dist/chunk-ZLW62TJG.cjs.map +0 -1
  165. package/dist/chunk-ZXKBDFP3.js.map +0 -1
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var chunk6AE5FKKQ_cjs = require('./chunk-6AE5FKKQ.cjs');
4
- var chunkJSCDE774_cjs = require('./chunk-JSCDE774.cjs');
3
+ var chunk724CXHFH_cjs = require('./chunk-724CXHFH.cjs');
4
+ var chunkZ6BGACIH_cjs = require('./chunk-Z6BGACIH.cjs');
5
5
 
6
6
  // src/random/index.ts
7
7
  var random_exports = {};
8
- chunkJSCDE774_cjs.__export(random_exports, {
8
+ chunkZ6BGACIH_cjs.__export(random_exports, {
9
9
  beta: () => beta,
10
10
  binomial: () => binomial,
11
11
  choice: () => choice,
@@ -81,7 +81,7 @@ var __SeededRandom = class {
81
81
  var __rng = null;
82
82
  function __setSeed(seed) {
83
83
  if (!Number.isFinite(seed)) {
84
- throw new chunkJSCDE774_cjs.InvalidParameterError(`seed must be a finite number; received ${seed}`, "seed", seed);
84
+ throw new chunkZ6BGACIH_cjs.InvalidParameterError(`seed must be a finite number; received ${seed}`, "seed", seed);
85
85
  }
86
86
  __globalSeed = seed;
87
87
  const seedUint64 = BigInt.asUintN(64, BigInt(Math.trunc(seed)));
@@ -106,7 +106,7 @@ function getCrypto() {
106
106
  function randomUint32FromCrypto() {
107
107
  const crypto2 = getCrypto();
108
108
  if (!crypto2) {
109
- throw new chunkJSCDE774_cjs.NotImplementedError(
109
+ throw new chunkZ6BGACIH_cjs.NotImplementedError(
110
110
  "Cryptographically secure randomness is unavailable in this environment. Provide a seed for deterministic randomness."
111
111
  );
112
112
  }
@@ -114,7 +114,7 @@ function randomUint32FromCrypto() {
114
114
  crypto2.getRandomValues(buf);
115
115
  const value = buf[0];
116
116
  if (value === void 0) {
117
- throw new chunkJSCDE774_cjs.InvalidParameterError("Failed to read cryptographic randomness", "crypto", value);
117
+ throw new chunkZ6BGACIH_cjs.InvalidParameterError("Failed to read cryptographic randomness", "crypto", value);
118
118
  }
119
119
  return value >>> 0;
120
120
  }
@@ -145,7 +145,7 @@ function __normalRandom() {
145
145
  }
146
146
  function __gammaLarge(shape) {
147
147
  if (!Number.isFinite(shape) || shape <= 1 / 3) {
148
- throw new chunkJSCDE774_cjs.InvalidParameterError(
148
+ throw new chunkZ6BGACIH_cjs.InvalidParameterError(
149
149
  "shape must be a finite number > 1/3 for Marsaglia-Tsang method",
150
150
  "shape",
151
151
  shape
@@ -177,31 +177,31 @@ var INT32_MAX = 2147483647;
177
177
  var UINT32_RANGE = 2 ** 32;
178
178
  var UINT53_RANGE = 2 ** 53;
179
179
  function resolveDevice(device) {
180
- const resolved = device ?? chunkJSCDE774_cjs.getConfig().defaultDevice;
181
- return chunkJSCDE774_cjs.validateDevice(resolved, "device");
180
+ const resolved = device ?? chunkZ6BGACIH_cjs.getConfig().defaultDevice;
181
+ return chunkZ6BGACIH_cjs.validateDevice(resolved, "device");
182
182
  }
183
183
  function resolveFloatDType(dtype, functionName) {
184
184
  const resolved = dtype ?? "float32";
185
185
  if (resolved !== "float32" && resolved !== "float64") {
186
- throw new chunkJSCDE774_cjs.DTypeError(`${functionName} only supports float32 or float64 dtype`);
186
+ throw new chunkZ6BGACIH_cjs.DTypeError(`${functionName} only supports float32 or float64 dtype`);
187
187
  }
188
188
  return resolved;
189
189
  }
190
190
  function resolveIntegerDType(dtype, functionName) {
191
191
  const resolved = dtype ?? "int32";
192
192
  if (resolved !== "int32" && resolved !== "int64") {
193
- throw new chunkJSCDE774_cjs.DTypeError(`${functionName} only supports int32 or int64 dtype`);
193
+ throw new chunkZ6BGACIH_cjs.DTypeError(`${functionName} only supports int32 or int64 dtype`);
194
194
  }
195
195
  return resolved;
196
196
  }
197
197
  function assertSafeInteger(value, name) {
198
198
  if (!Number.isFinite(value) || !Number.isInteger(value) || !Number.isSafeInteger(value)) {
199
- throw new chunkJSCDE774_cjs.InvalidParameterError(`${name} must be a safe integer`, name, value);
199
+ throw new chunkZ6BGACIH_cjs.InvalidParameterError(`${name} must be a safe integer`, name, value);
200
200
  }
201
201
  }
202
202
  function assertInt32Bounds(value, name) {
203
203
  if (value < INT32_MIN || value > INT32_MAX) {
204
- throw new chunkJSCDE774_cjs.InvalidParameterError(
204
+ throw new chunkZ6BGACIH_cjs.InvalidParameterError(
205
205
  `${name} must be within int32 range [${INT32_MIN}, ${INT32_MAX}]`,
206
206
  name,
207
207
  value
@@ -210,7 +210,7 @@ function assertInt32Bounds(value, name) {
210
210
  }
211
211
  function randomIntBelow(maxExclusive) {
212
212
  if (!Number.isSafeInteger(maxExclusive) || maxExclusive <= 0) {
213
- throw new chunkJSCDE774_cjs.InvalidParameterError("range must be a positive safe integer", "range", maxExclusive);
213
+ throw new chunkZ6BGACIH_cjs.InvalidParameterError("range must be a positive safe integer", "range", maxExclusive);
214
214
  }
215
215
  if (maxExclusive <= UINT32_RANGE) {
216
216
  const limit = Math.floor(UINT32_RANGE / maxExclusive) * maxExclusive;
@@ -228,7 +228,7 @@ function randomIntBelow(maxExclusive) {
228
228
  }
229
229
  return value % maxExclusive;
230
230
  }
231
- throw new chunkJSCDE774_cjs.InvalidParameterError(
231
+ throw new chunkZ6BGACIH_cjs.InvalidParameterError(
232
232
  "range must be <= 2^53 for unbiased sampling",
233
233
  "range",
234
234
  maxExclusive
@@ -256,7 +256,7 @@ function randomOpenUnit() {
256
256
  }
257
257
  function validateContiguous(t, functionName) {
258
258
  if (t.offset !== 0) {
259
- throw new chunkJSCDE774_cjs.InvalidParameterError(
259
+ throw new chunkZ6BGACIH_cjs.InvalidParameterError(
260
260
  `${functionName} currently requires offset === 0`,
261
261
  "offset",
262
262
  t.offset
@@ -266,7 +266,7 @@ function validateContiguous(t, functionName) {
266
266
  const expected = t.strides[axis];
267
267
  const tail = t.shape.slice(axis + 1).reduce((acc, v) => acc * v, 1);
268
268
  if (expected !== tail) {
269
- throw new chunkJSCDE774_cjs.InvalidParameterError(
269
+ throw new chunkZ6BGACIH_cjs.InvalidParameterError(
270
270
  `${functionName} currently requires a contiguous tensor`,
271
271
  "strides",
272
272
  t.strides
@@ -286,7 +286,7 @@ var LANCZOS_COEFFS = [
286
286
  ];
287
287
  function logGamma(z) {
288
288
  if (!Number.isFinite(z) || z <= 0) {
289
- throw new chunkJSCDE774_cjs.InvalidParameterError("logGamma requires a positive finite input", "z", z);
289
+ throw new chunkZ6BGACIH_cjs.InvalidParameterError("logGamma requires a positive finite input", "z", z);
290
290
  }
291
291
  let x = 0.9999999999998099;
292
292
  for (const [i, coeff] of LANCZOS_COEFFS.entries()) {
@@ -324,13 +324,13 @@ function clearSeed() {
324
324
  __clearSeed();
325
325
  }
326
326
  function rand(shape, opts = {}) {
327
- const size = chunkJSCDE774_cjs.shapeToSize(shape);
327
+ const size = chunkZ6BGACIH_cjs.shapeToSize(shape);
328
328
  const dtype = resolveFloatDType(opts.dtype, "rand");
329
329
  const data = allocateFloatBuffer(dtype, size);
330
330
  for (let i = 0; i < size; i++) {
331
331
  data[i] = __random();
332
332
  }
333
- return chunk6AE5FKKQ_cjs.Tensor.fromTypedArray({
333
+ return chunk724CXHFH_cjs.Tensor.fromTypedArray({
334
334
  data,
335
335
  shape,
336
336
  dtype,
@@ -338,13 +338,13 @@ function rand(shape, opts = {}) {
338
338
  });
339
339
  }
340
340
  function randn(shape, opts = {}) {
341
- const size = chunkJSCDE774_cjs.shapeToSize(shape);
341
+ const size = chunkZ6BGACIH_cjs.shapeToSize(shape);
342
342
  const dtype = resolveFloatDType(opts.dtype, "randn");
343
343
  const data = allocateFloatBuffer(dtype, size);
344
344
  for (let i = 0; i < size; i++) {
345
345
  data[i] = __normalRandom();
346
346
  }
347
- return chunk6AE5FKKQ_cjs.Tensor.fromTypedArray({
347
+ return chunk724CXHFH_cjs.Tensor.fromTypedArray({
348
348
  data,
349
349
  shape,
350
350
  dtype,
@@ -355,30 +355,30 @@ function randint(low, high, shape, opts = {}) {
355
355
  assertSafeInteger(low, "low");
356
356
  assertSafeInteger(high, "high");
357
357
  if (high <= low) {
358
- throw new chunkJSCDE774_cjs.InvalidParameterError("high must be > low", "high", high);
358
+ throw new chunkZ6BGACIH_cjs.InvalidParameterError("high must be > low", "high", high);
359
359
  }
360
360
  const dtype = resolveIntegerDType(opts.dtype, "randint");
361
361
  if (dtype === "int32") {
362
362
  assertInt32Bounds(low, "low");
363
363
  if (high > INT32_MAX + 1) {
364
- throw new chunkJSCDE774_cjs.InvalidParameterError(
364
+ throw new chunkZ6BGACIH_cjs.InvalidParameterError(
365
365
  `high must be <= ${INT32_MAX + 1} for int32 output`,
366
366
  "high",
367
367
  high
368
368
  );
369
369
  }
370
370
  }
371
- const size = chunkJSCDE774_cjs.shapeToSize(shape);
371
+ const size = chunkZ6BGACIH_cjs.shapeToSize(shape);
372
372
  const data = allocateIntegerBuffer(dtype, size);
373
373
  const range = high - low;
374
374
  if (!Number.isSafeInteger(range) || range <= 0) {
375
- throw new chunkJSCDE774_cjs.InvalidParameterError("range must be a positive safe integer", "high", high);
375
+ throw new chunkZ6BGACIH_cjs.InvalidParameterError("range must be a positive safe integer", "high", high);
376
376
  }
377
377
  for (let i = 0; i < size; i++) {
378
378
  const sample = randomIntBelow(range) + low;
379
379
  writeInteger(data, i, sample);
380
380
  }
381
- return chunk6AE5FKKQ_cjs.Tensor.fromTypedArray({
381
+ return chunk724CXHFH_cjs.Tensor.fromTypedArray({
382
382
  data,
383
383
  shape,
384
384
  dtype,
@@ -387,22 +387,22 @@ function randint(low, high, shape, opts = {}) {
387
387
  }
388
388
  function uniform(low = 0, high = 1, shape = [], opts = {}) {
389
389
  if (!Number.isFinite(low) || !Number.isFinite(high)) {
390
- throw new chunkJSCDE774_cjs.InvalidParameterError("low and high must be finite", "low/high", {
390
+ throw new chunkZ6BGACIH_cjs.InvalidParameterError("low and high must be finite", "low/high", {
391
391
  low,
392
392
  high
393
393
  });
394
394
  }
395
395
  if (high < low) {
396
- throw new chunkJSCDE774_cjs.InvalidParameterError("high must be >= low", "high", high);
396
+ throw new chunkZ6BGACIH_cjs.InvalidParameterError("high must be >= low", "high", high);
397
397
  }
398
- const size = chunkJSCDE774_cjs.shapeToSize(shape);
398
+ const size = chunkZ6BGACIH_cjs.shapeToSize(shape);
399
399
  const dtype = resolveFloatDType(opts.dtype, "uniform");
400
400
  const data = allocateFloatBuffer(dtype, size);
401
401
  const range = high - low;
402
402
  for (let i = 0; i < size; i++) {
403
403
  data[i] = __random() * range + low;
404
404
  }
405
- return chunk6AE5FKKQ_cjs.Tensor.fromTypedArray({
405
+ return chunk724CXHFH_cjs.Tensor.fromTypedArray({
406
406
  data,
407
407
  shape,
408
408
  dtype,
@@ -411,21 +411,21 @@ function uniform(low = 0, high = 1, shape = [], opts = {}) {
411
411
  }
412
412
  function normal(mean = 0, std = 1, shape = [], opts = {}) {
413
413
  if (!Number.isFinite(mean) || !Number.isFinite(std)) {
414
- throw new chunkJSCDE774_cjs.InvalidParameterError("mean and std must be finite", "mean/std", {
414
+ throw new chunkZ6BGACIH_cjs.InvalidParameterError("mean and std must be finite", "mean/std", {
415
415
  mean,
416
416
  std
417
417
  });
418
418
  }
419
419
  if (std < 0) {
420
- throw new chunkJSCDE774_cjs.InvalidParameterError("std must be >= 0", "std", std);
420
+ throw new chunkZ6BGACIH_cjs.InvalidParameterError("std must be >= 0", "std", std);
421
421
  }
422
- const size = chunkJSCDE774_cjs.shapeToSize(shape);
422
+ const size = chunkZ6BGACIH_cjs.shapeToSize(shape);
423
423
  const dtype = resolveFloatDType(opts.dtype, "normal");
424
424
  const data = allocateFloatBuffer(dtype, size);
425
425
  for (let i = 0; i < size; i++) {
426
426
  data[i] = __normalRandom() * std + mean;
427
427
  }
428
- return chunk6AE5FKKQ_cjs.Tensor.fromTypedArray({
428
+ return chunk724CXHFH_cjs.Tensor.fromTypedArray({
429
429
  data,
430
430
  shape,
431
431
  dtype,
@@ -480,21 +480,21 @@ function binomialChopDown(n, p, q, mode, pmfMode) {
480
480
  function binomial(n, p, shape = [], opts = {}) {
481
481
  assertSafeInteger(n, "n");
482
482
  if (n < 0) {
483
- throw new chunkJSCDE774_cjs.InvalidParameterError("n must be >= 0", "n", n);
483
+ throw new chunkZ6BGACIH_cjs.InvalidParameterError("n must be >= 0", "n", n);
484
484
  }
485
485
  if (!Number.isFinite(p) || p < 0 || p > 1) {
486
- throw new chunkJSCDE774_cjs.InvalidParameterError("p must be in [0, 1]", "p", p);
486
+ throw new chunkZ6BGACIH_cjs.InvalidParameterError("p must be in [0, 1]", "p", p);
487
487
  }
488
- const size = chunkJSCDE774_cjs.shapeToSize(shape);
488
+ const size = chunkZ6BGACIH_cjs.shapeToSize(shape);
489
489
  const dtype = resolveIntegerDType(opts.dtype, "binomial");
490
490
  if (dtype === "int32") {
491
491
  if (n > INT32_MAX) {
492
- throw new chunkJSCDE774_cjs.InvalidParameterError(`n must be <= ${INT32_MAX} for int32 output`, "n", n);
492
+ throw new chunkZ6BGACIH_cjs.InvalidParameterError(`n must be <= ${INT32_MAX} for int32 output`, "n", n);
493
493
  }
494
494
  }
495
495
  const data = allocateIntegerBuffer(dtype, size);
496
496
  if (n === 0) {
497
- return chunk6AE5FKKQ_cjs.Tensor.fromTypedArray({
497
+ return chunk724CXHFH_cjs.Tensor.fromTypedArray({
498
498
  data,
499
499
  shape,
500
500
  dtype,
@@ -502,7 +502,7 @@ function binomial(n, p, shape = [], opts = {}) {
502
502
  });
503
503
  }
504
504
  if (p === 0) {
505
- return chunk6AE5FKKQ_cjs.Tensor.fromTypedArray({
505
+ return chunk724CXHFH_cjs.Tensor.fromTypedArray({
506
506
  data,
507
507
  shape,
508
508
  dtype,
@@ -513,7 +513,7 @@ function binomial(n, p, shape = [], opts = {}) {
513
513
  for (let i = 0; i < size; i++) {
514
514
  writeInteger(data, i, n);
515
515
  }
516
- return chunk6AE5FKKQ_cjs.Tensor.fromTypedArray({
516
+ return chunk724CXHFH_cjs.Tensor.fromTypedArray({
517
517
  data,
518
518
  shape,
519
519
  dtype,
@@ -528,7 +528,7 @@ function binomial(n, p, shape = [], opts = {}) {
528
528
  for (let i = 0; i < size; i++) {
529
529
  writeInteger(data, i, value);
530
530
  }
531
- return chunk6AE5FKKQ_cjs.Tensor.fromTypedArray({
531
+ return chunk724CXHFH_cjs.Tensor.fromTypedArray({
532
532
  data,
533
533
  shape,
534
534
  dtype,
@@ -548,14 +548,14 @@ function binomial(n, p, shape = [], opts = {}) {
548
548
  const logPmfMode = logFactorial(n) - logFactorial(mode) - logFactorial(n - mode) + mode * logP + (n - mode) * logQ;
549
549
  const pmfMode = Math.exp(logPmfMode);
550
550
  if (!Number.isFinite(pmfMode) || pmfMode <= 0) {
551
- throw new chunkJSCDE774_cjs.InvalidParameterError("Failed to initialize binomial sampler", "p", p);
551
+ throw new chunkZ6BGACIH_cjs.InvalidParameterError("Failed to initialize binomial sampler", "p", p);
552
552
  }
553
553
  for (let i = 0; i < size; i++) {
554
554
  const sample = binomialChopDown(n, prob, q, mode, pmfMode);
555
555
  writeInteger(data, i, flip ? n - sample : sample);
556
556
  }
557
557
  }
558
- return chunk6AE5FKKQ_cjs.Tensor.fromTypedArray({
558
+ return chunk724CXHFH_cjs.Tensor.fromTypedArray({
559
559
  data,
560
560
  shape,
561
561
  dtype,
@@ -564,13 +564,13 @@ function binomial(n, p, shape = [], opts = {}) {
564
564
  }
565
565
  function poisson(lambda, shape = [], opts = {}) {
566
566
  if (!Number.isFinite(lambda) || lambda < 0) {
567
- throw new chunkJSCDE774_cjs.InvalidParameterError("lambda must be a finite number >= 0", "lambda", lambda);
567
+ throw new chunkZ6BGACIH_cjs.InvalidParameterError("lambda must be a finite number >= 0", "lambda", lambda);
568
568
  }
569
- const size = chunkJSCDE774_cjs.shapeToSize(shape);
569
+ const size = chunkZ6BGACIH_cjs.shapeToSize(shape);
570
570
  const dtype = resolveIntegerDType(opts.dtype, "poisson");
571
571
  if (dtype === "int32") {
572
572
  if (lambda > INT32_MAX) {
573
- throw new chunkJSCDE774_cjs.InvalidParameterError(
573
+ throw new chunkZ6BGACIH_cjs.InvalidParameterError(
574
574
  `lambda must be <= ${INT32_MAX} for int32 output`,
575
575
  "lambda",
576
576
  lambda
@@ -589,14 +589,14 @@ function poisson(lambda, shape = [], opts = {}) {
589
589
  } while (p > L);
590
590
  const sample = k - 1;
591
591
  if (!Number.isSafeInteger(sample)) {
592
- throw new chunkJSCDE774_cjs.InvalidParameterError(
592
+ throw new chunkZ6BGACIH_cjs.InvalidParameterError(
593
593
  "poisson sample exceeds safe integer range",
594
594
  "lambda",
595
595
  lambda
596
596
  );
597
597
  }
598
598
  if (dtype === "int32" && sample > INT32_MAX) {
599
- throw new chunkJSCDE774_cjs.InvalidParameterError("poisson sample exceeds int32 range", "lambda", lambda);
599
+ throw new chunkZ6BGACIH_cjs.InvalidParameterError("poisson sample exceeds int32 range", "lambda", lambda);
600
600
  }
601
601
  writeInteger(data, i, sample);
602
602
  }
@@ -618,14 +618,14 @@ function poisson(lambda, shape = [], opts = {}) {
618
618
  const rhs = k + n * Math.log(lambda) - logFactorial(n);
619
619
  if (lhs <= rhs) {
620
620
  if (!Number.isSafeInteger(n)) {
621
- throw new chunkJSCDE774_cjs.InvalidParameterError(
621
+ throw new chunkZ6BGACIH_cjs.InvalidParameterError(
622
622
  "poisson sample exceeds safe integer range",
623
623
  "lambda",
624
624
  lambda
625
625
  );
626
626
  }
627
627
  if (dtype === "int32" && n > INT32_MAX) {
628
- throw new chunkJSCDE774_cjs.InvalidParameterError("poisson sample exceeds int32 range", "lambda", lambda);
628
+ throw new chunkZ6BGACIH_cjs.InvalidParameterError("poisson sample exceeds int32 range", "lambda", lambda);
629
629
  }
630
630
  writeInteger(data, i, n);
631
631
  break;
@@ -633,7 +633,7 @@ function poisson(lambda, shape = [], opts = {}) {
633
633
  }
634
634
  }
635
635
  }
636
- return chunk6AE5FKKQ_cjs.Tensor.fromTypedArray({
636
+ return chunk724CXHFH_cjs.Tensor.fromTypedArray({
637
637
  data,
638
638
  shape,
639
639
  dtype,
@@ -642,16 +642,16 @@ function poisson(lambda, shape = [], opts = {}) {
642
642
  }
643
643
  function exponential(scale = 1, shape = [], opts = {}) {
644
644
  if (!Number.isFinite(scale) || scale <= 0) {
645
- throw new chunkJSCDE774_cjs.InvalidParameterError("scale must be a finite number > 0", "scale", scale);
645
+ throw new chunkZ6BGACIH_cjs.InvalidParameterError("scale must be a finite number > 0", "scale", scale);
646
646
  }
647
- const size = chunkJSCDE774_cjs.shapeToSize(shape);
647
+ const size = chunkZ6BGACIH_cjs.shapeToSize(shape);
648
648
  const dtype = resolveFloatDType(opts.dtype, "exponential");
649
649
  const data = allocateFloatBuffer(dtype, size);
650
650
  for (let i = 0; i < size; i++) {
651
651
  const u = randomOpenUnit();
652
652
  data[i] = -scale * Math.log(u);
653
653
  }
654
- return chunk6AE5FKKQ_cjs.Tensor.fromTypedArray({
654
+ return chunk724CXHFH_cjs.Tensor.fromTypedArray({
655
655
  data,
656
656
  shape,
657
657
  dtype,
@@ -660,22 +660,22 @@ function exponential(scale = 1, shape = [], opts = {}) {
660
660
  }
661
661
  function gamma(shape_param, scale = 1, shape = [], opts = {}) {
662
662
  if (!Number.isFinite(shape_param) || shape_param <= 0) {
663
- throw new chunkJSCDE774_cjs.InvalidParameterError(
663
+ throw new chunkZ6BGACIH_cjs.InvalidParameterError(
664
664
  "shape_param must be a finite number > 0",
665
665
  "shape_param",
666
666
  shape_param
667
667
  );
668
668
  }
669
669
  if (!Number.isFinite(scale) || scale <= 0) {
670
- throw new chunkJSCDE774_cjs.InvalidParameterError("scale must be a finite number > 0", "scale", scale);
670
+ throw new chunkZ6BGACIH_cjs.InvalidParameterError("scale must be a finite number > 0", "scale", scale);
671
671
  }
672
- const size = chunkJSCDE774_cjs.shapeToSize(shape);
672
+ const size = chunkZ6BGACIH_cjs.shapeToSize(shape);
673
673
  const dtype = resolveFloatDType(opts.dtype, "gamma");
674
674
  const data = allocateFloatBuffer(dtype, size);
675
675
  for (let i = 0; i < size; i++) {
676
676
  data[i] = sampleGammaUnit(shape_param) * scale;
677
677
  }
678
- return chunk6AE5FKKQ_cjs.Tensor.fromTypedArray({
678
+ return chunk724CXHFH_cjs.Tensor.fromTypedArray({
679
679
  data,
680
680
  shape,
681
681
  dtype,
@@ -684,12 +684,12 @@ function gamma(shape_param, scale = 1, shape = [], opts = {}) {
684
684
  }
685
685
  function beta(alpha, beta_param, shape = [], opts = {}) {
686
686
  if (!Number.isFinite(alpha) || alpha <= 0) {
687
- throw new chunkJSCDE774_cjs.InvalidParameterError("alpha must be a finite number > 0", "alpha", alpha);
687
+ throw new chunkZ6BGACIH_cjs.InvalidParameterError("alpha must be a finite number > 0", "alpha", alpha);
688
688
  }
689
689
  if (!Number.isFinite(beta_param) || beta_param <= 0) {
690
- throw new chunkJSCDE774_cjs.InvalidParameterError("beta must be a finite number > 0", "beta_param", beta_param);
690
+ throw new chunkZ6BGACIH_cjs.InvalidParameterError("beta must be a finite number > 0", "beta_param", beta_param);
691
691
  }
692
- const size = chunkJSCDE774_cjs.shapeToSize(shape);
692
+ const size = chunkZ6BGACIH_cjs.shapeToSize(shape);
693
693
  const dtype = resolveFloatDType(opts.dtype, "beta");
694
694
  const data = allocateFloatBuffer(dtype, size);
695
695
  for (let i = 0; i < size; i++) {
@@ -709,14 +709,14 @@ function beta(alpha, beta_param, shape = [], opts = {}) {
709
709
  }
710
710
  }
711
711
  if (!sampled) {
712
- throw new chunkJSCDE774_cjs.InvalidParameterError(
712
+ throw new chunkZ6BGACIH_cjs.InvalidParameterError(
713
713
  "beta sampling failed to produce a finite sample",
714
714
  "alpha/beta_param",
715
715
  { alpha, beta_param }
716
716
  );
717
717
  }
718
718
  }
719
- return chunk6AE5FKKQ_cjs.Tensor.fromTypedArray({
719
+ return chunk724CXHFH_cjs.Tensor.fromTypedArray({
720
720
  data,
721
721
  shape,
722
722
  dtype,
@@ -725,13 +725,13 @@ function beta(alpha, beta_param, shape = [], opts = {}) {
725
725
  }
726
726
  function readNumericTensorValue(t, index) {
727
727
  if (t.dtype === "string") {
728
- throw new chunkJSCDE774_cjs.DTypeError("Expected numeric tensor");
728
+ throw new chunkZ6BGACIH_cjs.DTypeError("Expected numeric tensor");
729
729
  }
730
730
  const value = t.data[index];
731
731
  if (typeof value === "number" || typeof value === "bigint") {
732
732
  return value;
733
733
  }
734
- throw new chunkJSCDE774_cjs.InvalidParameterError("Internal error: tensor index out of bounds", "index", index);
734
+ throw new chunkZ6BGACIH_cjs.InvalidParameterError("Internal error: tensor index out of bounds", "index", index);
735
735
  }
736
736
  function allocateNumericBuffer(dtype, size) {
737
737
  switch (dtype) {
@@ -747,7 +747,7 @@ function allocateNumericBuffer(dtype, size) {
747
747
  case "bool":
748
748
  return new Uint8Array(size);
749
749
  case "string":
750
- throw new chunkJSCDE774_cjs.DTypeError("choice() does not support string tensors");
750
+ throw new chunkZ6BGACIH_cjs.DTypeError("choice() does not support string tensors");
751
751
  }
752
752
  }
753
753
  function writeNumericValue(out, index, value) {
@@ -763,13 +763,13 @@ function writeNumericValue(out, index, value) {
763
763
  }
764
764
  function buildNormalizedProbabilities(probabilities, n) {
765
765
  if (probabilities.dtype === "string") {
766
- throw new chunkJSCDE774_cjs.DTypeError("choice() probabilities must be numeric");
766
+ throw new chunkZ6BGACIH_cjs.DTypeError("choice() probabilities must be numeric");
767
767
  }
768
768
  if (probabilities.ndim !== 1) {
769
- throw new chunkJSCDE774_cjs.InvalidParameterError("p must be a 1D tensor", "p", probabilities.shape);
769
+ throw new chunkZ6BGACIH_cjs.InvalidParameterError("p must be a 1D tensor", "p", probabilities.shape);
770
770
  }
771
771
  if (probabilities.size !== n) {
772
- throw new chunkJSCDE774_cjs.InvalidParameterError(
772
+ throw new chunkZ6BGACIH_cjs.InvalidParameterError(
773
773
  "p must have the same length as the population",
774
774
  "p",
775
775
  probabilities.size
@@ -781,7 +781,7 @@ function buildNormalizedProbabilities(probabilities, n) {
781
781
  for (let i = 0; i < n; i++) {
782
782
  const value = Number(readNumericTensorValue(probabilities, i));
783
783
  if (!Number.isFinite(value) || value < 0) {
784
- throw new chunkJSCDE774_cjs.InvalidParameterError(
784
+ throw new chunkZ6BGACIH_cjs.InvalidParameterError(
785
785
  "p must contain finite non-negative probabilities",
786
786
  "p",
787
787
  value
@@ -791,7 +791,7 @@ function buildNormalizedProbabilities(probabilities, n) {
791
791
  sum += value;
792
792
  }
793
793
  if (!Number.isFinite(sum) || sum <= 0) {
794
- throw new chunkJSCDE774_cjs.InvalidParameterError("sum(p) must be > 0 and finite", "p", sum);
794
+ throw new chunkZ6BGACIH_cjs.InvalidParameterError("sum(p) must be > 0 and finite", "p", sum);
795
795
  }
796
796
  for (let i = 0; i < n; i++) {
797
797
  normalized[i] = (normalized[i] ?? 0) / sum;
@@ -806,7 +806,7 @@ function sampleFromCdf(cdf) {
806
806
  const mid = Math.floor((left + right) / 2);
807
807
  const value = cdf[mid];
808
808
  if (value === void 0) {
809
- throw new chunkJSCDE774_cjs.InvalidParameterError("Internal error: invalid CDF index", "mid", mid);
809
+ throw new chunkZ6BGACIH_cjs.InvalidParameterError("Internal error: invalid CDF index", "mid", mid);
810
810
  }
811
811
  if (u <= value) {
812
812
  right = mid;
@@ -820,44 +820,44 @@ function choice(a, size, replace = true, p) {
820
820
  if (typeof a === "number") {
821
821
  assertSafeInteger(a, "a");
822
822
  if (a < 0) {
823
- throw new chunkJSCDE774_cjs.InvalidParameterError("Invalid population size", "a", a);
823
+ throw new chunkZ6BGACIH_cjs.InvalidParameterError("Invalid population size", "a", a);
824
824
  }
825
825
  if (a > INT32_MAX + 1) {
826
- throw new chunkJSCDE774_cjs.InvalidParameterError(
826
+ throw new chunkZ6BGACIH_cjs.InvalidParameterError(
827
827
  `Population size must be <= ${INT32_MAX + 1} for choice()`,
828
828
  "a",
829
829
  a
830
830
  );
831
831
  }
832
832
  }
833
- const aa = typeof a === "number" ? chunk6AE5FKKQ_cjs.arange(0, a, 1, { dtype: "int32" }) : a;
833
+ const aa = typeof a === "number" ? chunk724CXHFH_cjs.arange(0, a, 1, { dtype: "int32" }) : a;
834
834
  if (aa.dtype === "string") {
835
- throw new chunkJSCDE774_cjs.DTypeError("choice() does not support string tensors");
835
+ throw new chunkZ6BGACIH_cjs.DTypeError("choice() does not support string tensors");
836
836
  }
837
837
  const n = aa.size;
838
838
  if (!Number.isInteger(n) || n < 0) {
839
- throw new chunkJSCDE774_cjs.InvalidParameterError("Invalid tensor size", "n", n);
839
+ throw new chunkZ6BGACIH_cjs.InvalidParameterError("Invalid tensor size", "n", n);
840
840
  }
841
841
  if (n > INT32_MAX + 1) {
842
- throw new chunkJSCDE774_cjs.InvalidParameterError(`Population size must be <= ${INT32_MAX + 1}`, "n", n);
842
+ throw new chunkZ6BGACIH_cjs.InvalidParameterError(`Population size must be <= ${INT32_MAX + 1}`, "n", n);
843
843
  }
844
844
  let outputSize;
845
845
  if (typeof size === "number") {
846
846
  outputSize = size;
847
847
  } else if (size) {
848
- chunkJSCDE774_cjs.validateShape(size);
849
- outputSize = chunkJSCDE774_cjs.shapeToSize(size);
848
+ chunkZ6BGACIH_cjs.validateShape(size);
849
+ outputSize = chunkZ6BGACIH_cjs.shapeToSize(size);
850
850
  } else {
851
851
  outputSize = 1;
852
852
  }
853
853
  if (!Number.isSafeInteger(outputSize) || outputSize < 0) {
854
- throw new chunkJSCDE774_cjs.InvalidParameterError("size must be an integer >= 0", "size", size);
854
+ throw new chunkZ6BGACIH_cjs.InvalidParameterError("size must be an integer >= 0", "size", size);
855
855
  }
856
856
  if (outputSize > INT32_MAX) {
857
- throw new chunkJSCDE774_cjs.InvalidParameterError(`size must be <= ${INT32_MAX}`, "size", outputSize);
857
+ throw new chunkZ6BGACIH_cjs.InvalidParameterError(`size must be <= ${INT32_MAX}`, "size", outputSize);
858
858
  }
859
859
  if (n === 0 && outputSize > 0) {
860
- throw new chunkJSCDE774_cjs.InvalidParameterError("Cannot sample from an empty population", "a", a);
860
+ throw new chunkZ6BGACIH_cjs.InvalidParameterError("Cannot sample from an empty population", "a", a);
861
861
  }
862
862
  const indices = new Int32Array(outputSize);
863
863
  const weights = p ? buildNormalizedProbabilities(p, n) : void 0;
@@ -879,7 +879,7 @@ function choice(a, size, replace = true, p) {
879
879
  if ((weights[i] ?? 0) > 0) nonZeroCount++;
880
880
  }
881
881
  if (outputSize > nonZeroCount) {
882
- throw new chunkJSCDE774_cjs.InvalidParameterError(
882
+ throw new chunkZ6BGACIH_cjs.InvalidParameterError(
883
883
  "Cannot sample without replacement with zero-probability mass for requested size",
884
884
  "size",
885
885
  outputSize
@@ -889,7 +889,7 @@ function choice(a, size, replace = true, p) {
889
889
  let remainingMass = 1;
890
890
  for (let i = 0; i < outputSize; i++) {
891
891
  if (remainingMass <= 0) {
892
- throw new chunkJSCDE774_cjs.InvalidParameterError(
892
+ throw new chunkZ6BGACIH_cjs.InvalidParameterError(
893
893
  "Insufficient probability mass to sample",
894
894
  "p",
895
895
  remainingMass
@@ -918,7 +918,7 @@ function choice(a, size, replace = true, p) {
918
918
  }
919
919
  }
920
920
  if (chosen < 0) {
921
- throw new chunkJSCDE774_cjs.InvalidParameterError("Failed to select weighted sample", "p", weights);
921
+ throw new chunkZ6BGACIH_cjs.InvalidParameterError("Failed to select weighted sample", "p", weights);
922
922
  }
923
923
  indices[i] = chosen;
924
924
  remainingMass -= remaining[chosen] ?? 0;
@@ -931,7 +931,7 @@ function choice(a, size, replace = true, p) {
931
931
  }
932
932
  } else {
933
933
  if (outputSize > n) {
934
- throw new chunkJSCDE774_cjs.InvalidParameterError(
934
+ throw new chunkZ6BGACIH_cjs.InvalidParameterError(
935
935
  "Cannot sample without replacement when size > population",
936
936
  "size",
937
937
  outputSize
@@ -943,7 +943,7 @@ function choice(a, size, replace = true, p) {
943
943
  const poolI = pool[i];
944
944
  const poolJ = pool[j];
945
945
  if (poolI === void 0 || poolJ === void 0) {
946
- throw new chunkJSCDE774_cjs.InvalidParameterError("Internal error: pool index out of bounds", "pool", {
946
+ throw new chunkZ6BGACIH_cjs.InvalidParameterError("Internal error: pool index out of bounds", "pool", {
947
947
  i,
948
948
  j,
949
949
  n
@@ -960,12 +960,12 @@ function choice(a, size, replace = true, p) {
960
960
  for (let i = 0; i < outputSize; i++) {
961
961
  const idx = indices[i];
962
962
  if (idx === void 0) {
963
- throw new chunkJSCDE774_cjs.InvalidParameterError("Internal error: undefined index", "indices", i);
963
+ throw new chunkZ6BGACIH_cjs.InvalidParameterError("Internal error: undefined index", "indices", i);
964
964
  }
965
965
  const value = readNumericTensorValue(aa, idx);
966
966
  writeNumericValue(out, i, value);
967
967
  }
968
- return chunk6AE5FKKQ_cjs.Tensor.fromTypedArray({
968
+ return chunk724CXHFH_cjs.Tensor.fromTypedArray({
969
969
  data: out,
970
970
  shape: outputShape,
971
971
  dtype: aa.dtype,
@@ -974,12 +974,12 @@ function choice(a, size, replace = true, p) {
974
974
  }
975
975
  function shuffle(x) {
976
976
  if (x.dtype === "string") {
977
- throw new chunkJSCDE774_cjs.DTypeError("shuffle() does not support string tensors");
977
+ throw new chunkZ6BGACIH_cjs.DTypeError("shuffle() does not support string tensors");
978
978
  }
979
979
  validateContiguous(x, "shuffle()");
980
980
  const data = x.data;
981
- if (!chunkJSCDE774_cjs.isTypedArray(data)) {
982
- throw new chunkJSCDE774_cjs.DTypeError("shuffle() does not support string tensors");
981
+ if (!chunkZ6BGACIH_cjs.isTypedArray(data)) {
982
+ throw new chunkZ6BGACIH_cjs.DTypeError("shuffle() does not support string tensors");
983
983
  }
984
984
  const n = data.length;
985
985
  if (data instanceof BigInt64Array) {
@@ -988,7 +988,7 @@ function shuffle(x) {
988
988
  const temp = data[i];
989
989
  const swap = data[j];
990
990
  if (temp === void 0 || swap === void 0) {
991
- throw new chunkJSCDE774_cjs.DeepboxError("Internal error: shuffle index out of bounds");
991
+ throw new chunkZ6BGACIH_cjs.DeepboxError("Internal error: shuffle index out of bounds");
992
992
  }
993
993
  data[i] = swap;
994
994
  data[j] = temp;
@@ -999,7 +999,7 @@ function shuffle(x) {
999
999
  const temp = data[i];
1000
1000
  const swap = data[j];
1001
1001
  if (temp === void 0 || swap === void 0) {
1002
- throw new chunkJSCDE774_cjs.DeepboxError("Internal error: shuffle index out of bounds");
1002
+ throw new chunkZ6BGACIH_cjs.DeepboxError("Internal error: shuffle index out of bounds");
1003
1003
  }
1004
1004
  data[i] = swap;
1005
1005
  data[j] = temp;
@@ -1011,10 +1011,10 @@ function permutation(x) {
1011
1011
  assertSafeInteger(x, "x");
1012
1012
  const n = x;
1013
1013
  if (n < 0) {
1014
- throw new chunkJSCDE774_cjs.InvalidParameterError("x must be a non-negative integer", "x", x);
1014
+ throw new chunkZ6BGACIH_cjs.InvalidParameterError("x must be a non-negative integer", "x", x);
1015
1015
  }
1016
1016
  if (n > INT32_MAX + 1) {
1017
- throw new chunkJSCDE774_cjs.InvalidParameterError(`x must be <= ${INT32_MAX + 1} for int32 output`, "x", x);
1017
+ throw new chunkZ6BGACIH_cjs.InvalidParameterError(`x must be <= ${INT32_MAX + 1} for int32 output`, "x", x);
1018
1018
  }
1019
1019
  const indices = Array.from({ length: n }, (_, i) => i);
1020
1020
  for (let i = n - 1; i > 0; i--) {
@@ -1022,7 +1022,7 @@ function permutation(x) {
1022
1022
  const indicesI = indices[i];
1023
1023
  const indicesJ = indices[j];
1024
1024
  if (indicesI === void 0 || indicesJ === void 0) {
1025
- throw new chunkJSCDE774_cjs.InvalidParameterError("Internal error: indices out of bounds", "indices", {
1025
+ throw new chunkZ6BGACIH_cjs.InvalidParameterError("Internal error: indices out of bounds", "indices", {
1026
1026
  i,
1027
1027
  j,
1028
1028
  n
@@ -1031,17 +1031,17 @@ function permutation(x) {
1031
1031
  indices[i] = indicesJ;
1032
1032
  indices[j] = indicesI;
1033
1033
  }
1034
- return chunk6AE5FKKQ_cjs.tensor(indices, { dtype: "int32" });
1034
+ return chunk724CXHFH_cjs.tensor(indices, { dtype: "int32" });
1035
1035
  }
1036
1036
  if (x.dtype === "string") {
1037
- throw new chunkJSCDE774_cjs.DTypeError("permutation() does not support string tensors");
1037
+ throw new chunkZ6BGACIH_cjs.DTypeError("permutation() does not support string tensors");
1038
1038
  }
1039
1039
  validateContiguous(x, "permutation()");
1040
1040
  const data = x.data;
1041
- if (!chunkJSCDE774_cjs.isTypedArray(data)) {
1042
- throw new chunkJSCDE774_cjs.DTypeError("permutation() does not support string tensors");
1041
+ if (!chunkZ6BGACIH_cjs.isTypedArray(data)) {
1042
+ throw new chunkZ6BGACIH_cjs.DTypeError("permutation() does not support string tensors");
1043
1043
  }
1044
- const copy = chunk6AE5FKKQ_cjs.Tensor.fromTypedArray({
1044
+ const copy = chunk724CXHFH_cjs.Tensor.fromTypedArray({
1045
1045
  data: data.slice(),
1046
1046
  shape: x.shape,
1047
1047
  dtype: x.dtype,
@@ -1068,5 +1068,5 @@ exports.random_exports = random_exports;
1068
1068
  exports.setSeed = setSeed;
1069
1069
  exports.shuffle = shuffle;
1070
1070
  exports.uniform = uniform;
1071
- //# sourceMappingURL=chunk-PHV2DKRS.cjs.map
1072
- //# sourceMappingURL=chunk-PHV2DKRS.cjs.map
1071
+ //# sourceMappingURL=chunk-HDKMIG6E.cjs.map
1072
+ //# sourceMappingURL=chunk-HDKMIG6E.cjs.map