@thi.ng/tensors 0.10.13 → 0.10.14
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/README.md +2 -2
- package/package.json +13 -12
- package/tensor.js +4 -4
- package/top.js +2 -2
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
[](https://mastodon.thi.ng/@toxi)
|
|
8
8
|
|
|
9
9
|
> [!NOTE]
|
|
10
|
-
> This is one of
|
|
10
|
+
> This is one of 214 standalone projects, maintained as part
|
|
11
11
|
> of the [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo
|
|
12
12
|
> and anti-framework.
|
|
13
13
|
>
|
|
@@ -250,7 +250,7 @@ For Node.js REPL:
|
|
|
250
250
|
const ten = await import("@thi.ng/tensors");
|
|
251
251
|
```
|
|
252
252
|
|
|
253
|
-
Package sizes (brotli'd, pre-treeshake): ESM: 11.
|
|
253
|
+
Package sizes (brotli'd, pre-treeshake): ESM: 11.45 KB
|
|
254
254
|
|
|
255
255
|
## Dependencies
|
|
256
256
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/tensors",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.14",
|
|
4
4
|
"description": "0D/1D/2D/3D/4D tensors with extensible polymorphic operations and customizable storage",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
"sideEffects": false,
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
11
|
-
"url": "https://github.com/thi-ng/umbrella.git"
|
|
11
|
+
"url": "git+https://github.com/thi-ng/umbrella.git",
|
|
12
|
+
"directory": "packages/tensors"
|
|
12
13
|
},
|
|
13
14
|
"homepage": "https://thi.ng/tensors",
|
|
14
15
|
"funding": [
|
|
@@ -39,15 +40,15 @@
|
|
|
39
40
|
"tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
|
|
40
41
|
},
|
|
41
42
|
"dependencies": {
|
|
42
|
-
"@thi.ng/api": "^8.12.
|
|
43
|
-
"@thi.ng/arrays": "^2.14.
|
|
44
|
-
"@thi.ng/checks": "^3.8.
|
|
45
|
-
"@thi.ng/equiv": "^2.1.
|
|
46
|
-
"@thi.ng/errors": "^2.6.
|
|
47
|
-
"@thi.ng/math": "^5.15.
|
|
48
|
-
"@thi.ng/random": "^4.1.
|
|
49
|
-
"@thi.ng/strings": "^3.9.
|
|
50
|
-
"@thi.ng/vectors": "^8.6.
|
|
43
|
+
"@thi.ng/api": "^8.12.14",
|
|
44
|
+
"@thi.ng/arrays": "^2.14.7",
|
|
45
|
+
"@thi.ng/checks": "^3.8.4",
|
|
46
|
+
"@thi.ng/equiv": "^2.1.104",
|
|
47
|
+
"@thi.ng/errors": "^2.6.3",
|
|
48
|
+
"@thi.ng/math": "^5.15.3",
|
|
49
|
+
"@thi.ng/random": "^4.1.39",
|
|
50
|
+
"@thi.ng/strings": "^3.9.35",
|
|
51
|
+
"@thi.ng/vectors": "^8.6.20"
|
|
51
52
|
},
|
|
52
53
|
"devDependencies": {
|
|
53
54
|
"esbuild": "^0.27.2",
|
|
@@ -342,5 +343,5 @@
|
|
|
342
343
|
"status": "alpha",
|
|
343
344
|
"year": 2018
|
|
344
345
|
},
|
|
345
|
-
"gitHead": "
|
|
346
|
+
"gitHead": "4bd1b9d8ae52ba32b90a1b9a55d329c708ca7865\n"
|
|
346
347
|
}
|
package/tensor.js
CHANGED
|
@@ -3,7 +3,7 @@ import { isNumber } from "@thi.ng/checks/is-number";
|
|
|
3
3
|
import { equiv, equivArrayLike } from "@thi.ng/equiv";
|
|
4
4
|
import { illegalArgs } from "@thi.ng/errors/illegal-arguments";
|
|
5
5
|
import { outOfBounds } from "@thi.ng/errors/out-of-bounds";
|
|
6
|
-
import {
|
|
6
|
+
import { unsupportedOp } from "@thi.ng/errors/unsupported";
|
|
7
7
|
import { dot2, dot3, dot4 } from "@thi.ng/vectors/dot";
|
|
8
8
|
import { eqDeltaS as _eqDelta } from "@thi.ng/vectors/eqdelta";
|
|
9
9
|
import { product, product2, product3, product4 } from "@thi.ng/vectors/product";
|
|
@@ -222,7 +222,7 @@ class Tensor0 extends ATensor {
|
|
|
222
222
|
});
|
|
223
223
|
}
|
|
224
224
|
transpose(_) {
|
|
225
|
-
return
|
|
225
|
+
return unsupportedOp();
|
|
226
226
|
}
|
|
227
227
|
toString() {
|
|
228
228
|
return format(this.get());
|
|
@@ -291,7 +291,7 @@ class Tensor1 extends ATensor {
|
|
|
291
291
|
});
|
|
292
292
|
}
|
|
293
293
|
transpose(_) {
|
|
294
|
-
return
|
|
294
|
+
return unsupportedOp();
|
|
295
295
|
}
|
|
296
296
|
toString() {
|
|
297
297
|
const res = [];
|
|
@@ -523,7 +523,7 @@ function tensor(...args) {
|
|
|
523
523
|
data = storage.alloc(dim > 0 ? product(shape) : 1);
|
|
524
524
|
}
|
|
525
525
|
const ctor = TENSOR_IMPLS[dim];
|
|
526
|
-
return ctor ? new ctor(type, storage, data, shape, stride, offset) :
|
|
526
|
+
return ctor ? new ctor(type, storage, data, shape, stride, offset) : illegalArgs(`unsupported dimension: ${dim}`);
|
|
527
527
|
}
|
|
528
528
|
const __tensor0 = (x) => {
|
|
529
529
|
const type = isNumber(x) ? "num" : "str";
|
package/top.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { unsupportedOp } from "@thi.ng/errors/unsupported";
|
|
2
2
|
const top = (dispatch = 1, fallback, ...optimized) => {
|
|
3
3
|
const impls = [void 0].concat(optimized);
|
|
4
4
|
const fn = (...args) => {
|
|
5
5
|
const g = impls[args[dispatch].dim] || fallback;
|
|
6
|
-
return g ? g(...args) :
|
|
6
|
+
return g ? g(...args) : unsupportedOp(`no impl for dimension ${args[dispatch].dim}`);
|
|
7
7
|
};
|
|
8
8
|
fn.add = (dim, fn2) => impls[dim] = fn2;
|
|
9
9
|
fn.default = (fn2) => fallback = fn2;
|