@thi.ng/tensors 0.9.0 → 0.10.4
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 +1 -1
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +345 -342
- package/sample.d.ts +27 -0
- package/sample.js +290 -0
- package/CHANGELOG.md +0 -146
package/README.md
CHANGED
package/index.d.ts
CHANGED
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,343 +1,346 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
2
|
+
"name": "@thi.ng/tensors",
|
|
3
|
+
"version": "0.10.4",
|
|
4
|
+
"description": "0D/1D/2D/3D/4D tensors with extensible polymorphic operations and customizable storage",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"module": "./index.js",
|
|
7
|
+
"typings": "./index.d.ts",
|
|
8
|
+
"sideEffects": false,
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/thi-ng/umbrella.git"
|
|
12
|
+
},
|
|
13
|
+
"homepage": "https://thi.ng/tensors",
|
|
14
|
+
"funding": [
|
|
15
|
+
{
|
|
16
|
+
"type": "github",
|
|
17
|
+
"url": "https://github.com/sponsors/postspectacular"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"type": "patreon",
|
|
21
|
+
"url": "https://patreon.com/thing_umbrella"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"type": "liberapay",
|
|
25
|
+
"url": "https://liberapay.com/thi.ng"
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
"author": "Karsten Schmidt (https://thi.ng)",
|
|
29
|
+
"license": "Apache-2.0",
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "yarn build:esbuild && yarn build:decl",
|
|
32
|
+
"build:decl": "tsc --declaration --emitDeclarationOnly",
|
|
33
|
+
"build:esbuild": "esbuild --format=esm --platform=neutral --target=es2022 --tsconfig=tsconfig.json --outdir=. src/**/*.ts",
|
|
34
|
+
"clean": "bun ../../tools/src/clean-package.ts",
|
|
35
|
+
"doc": "typedoc --options ../../typedoc.json --out doc src/index.ts",
|
|
36
|
+
"doc:readme": "bun ../../tools/src/module-stats.ts && bun ../../tools/src/readme.ts",
|
|
37
|
+
"pub": "npm publish --access public",
|
|
38
|
+
"test": "bun test",
|
|
39
|
+
"tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@thi.ng/api": "^8.12.6",
|
|
43
|
+
"@thi.ng/arrays": "^2.13.15",
|
|
44
|
+
"@thi.ng/checks": "^3.7.22",
|
|
45
|
+
"@thi.ng/equiv": "^2.1.96",
|
|
46
|
+
"@thi.ng/errors": "^2.5.46",
|
|
47
|
+
"@thi.ng/math": "^5.13.3",
|
|
48
|
+
"@thi.ng/random": "^4.1.31",
|
|
49
|
+
"@thi.ng/strings": "^3.9.26",
|
|
50
|
+
"@thi.ng/vectors": "^8.6.10"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"esbuild": "^0.25.11",
|
|
54
|
+
"typedoc": "^0.28.14",
|
|
55
|
+
"typescript": "^5.9.3"
|
|
56
|
+
},
|
|
57
|
+
"keywords": [
|
|
58
|
+
"1d",
|
|
59
|
+
"2d",
|
|
60
|
+
"3d",
|
|
61
|
+
"4d",
|
|
62
|
+
"activation",
|
|
63
|
+
"algebra",
|
|
64
|
+
"array",
|
|
65
|
+
"blur",
|
|
66
|
+
"broadcast",
|
|
67
|
+
"conversion",
|
|
68
|
+
"convolution",
|
|
69
|
+
"data-oriented",
|
|
70
|
+
"datastructure",
|
|
71
|
+
"decomposition",
|
|
72
|
+
"detect",
|
|
73
|
+
"diagonal",
|
|
74
|
+
"dotproduct",
|
|
75
|
+
"edge",
|
|
76
|
+
"equality",
|
|
77
|
+
"filter",
|
|
78
|
+
"gaussian",
|
|
79
|
+
"gradient",
|
|
80
|
+
"interval",
|
|
81
|
+
"math",
|
|
82
|
+
"matrix",
|
|
83
|
+
"memory-mapped",
|
|
84
|
+
"nd",
|
|
85
|
+
"polymorphic",
|
|
86
|
+
"pool",
|
|
87
|
+
"presets",
|
|
88
|
+
"random",
|
|
89
|
+
"smoothstep",
|
|
90
|
+
"step",
|
|
91
|
+
"svd",
|
|
92
|
+
"tensor",
|
|
93
|
+
"typedarray",
|
|
94
|
+
"typescript",
|
|
95
|
+
"vector"
|
|
96
|
+
],
|
|
97
|
+
"publishConfig": {
|
|
98
|
+
"access": "public"
|
|
99
|
+
},
|
|
100
|
+
"browser": {
|
|
101
|
+
"process": false,
|
|
102
|
+
"setTimeout": false
|
|
103
|
+
},
|
|
104
|
+
"engines": {
|
|
105
|
+
"node": ">=18"
|
|
106
|
+
},
|
|
107
|
+
"files": [
|
|
108
|
+
"./*.js",
|
|
109
|
+
"./*.d.ts"
|
|
110
|
+
],
|
|
111
|
+
"exports": {
|
|
112
|
+
".": {
|
|
113
|
+
"default": "./index.js"
|
|
114
|
+
},
|
|
115
|
+
"./abs": {
|
|
116
|
+
"default": "./abs.js"
|
|
117
|
+
},
|
|
118
|
+
"./add": {
|
|
119
|
+
"default": "./add.js"
|
|
120
|
+
},
|
|
121
|
+
"./addn": {
|
|
122
|
+
"default": "./addn.js"
|
|
123
|
+
},
|
|
124
|
+
"./api": {
|
|
125
|
+
"default": "./api.js"
|
|
126
|
+
},
|
|
127
|
+
"./apply-kernel": {
|
|
128
|
+
"default": "./apply-kernel.js"
|
|
129
|
+
},
|
|
130
|
+
"./broadcast": {
|
|
131
|
+
"default": "./broadcast.js"
|
|
132
|
+
},
|
|
133
|
+
"./clamp": {
|
|
134
|
+
"default": "./clamp.js"
|
|
135
|
+
},
|
|
136
|
+
"./clampn": {
|
|
137
|
+
"default": "./clampn.js"
|
|
138
|
+
},
|
|
139
|
+
"./convert": {
|
|
140
|
+
"default": "./convert.js"
|
|
141
|
+
},
|
|
142
|
+
"./convolve": {
|
|
143
|
+
"default": "./convolve.js"
|
|
144
|
+
},
|
|
145
|
+
"./cos": {
|
|
146
|
+
"default": "./cos.js"
|
|
147
|
+
},
|
|
148
|
+
"./defopn": {
|
|
149
|
+
"default": "./defopn.js"
|
|
150
|
+
},
|
|
151
|
+
"./defoprt": {
|
|
152
|
+
"default": "./defoprt.js"
|
|
153
|
+
},
|
|
154
|
+
"./defoprtt": {
|
|
155
|
+
"default": "./defoprtt.js"
|
|
156
|
+
},
|
|
157
|
+
"./defopt": {
|
|
158
|
+
"default": "./defopt.js"
|
|
159
|
+
},
|
|
160
|
+
"./defoptn": {
|
|
161
|
+
"default": "./defoptn.js"
|
|
162
|
+
},
|
|
163
|
+
"./defoptnn": {
|
|
164
|
+
"default": "./defoptnn.js"
|
|
165
|
+
},
|
|
166
|
+
"./defoptt": {
|
|
167
|
+
"default": "./defoptt.js"
|
|
168
|
+
},
|
|
169
|
+
"./defopttt": {
|
|
170
|
+
"default": "./defopttt.js"
|
|
171
|
+
},
|
|
172
|
+
"./diagonal": {
|
|
173
|
+
"default": "./diagonal.js"
|
|
174
|
+
},
|
|
175
|
+
"./div": {
|
|
176
|
+
"default": "./div.js"
|
|
177
|
+
},
|
|
178
|
+
"./divn": {
|
|
179
|
+
"default": "./divn.js"
|
|
180
|
+
},
|
|
181
|
+
"./dot": {
|
|
182
|
+
"default": "./dot.js"
|
|
183
|
+
},
|
|
184
|
+
"./errors": {
|
|
185
|
+
"default": "./errors.js"
|
|
186
|
+
},
|
|
187
|
+
"./exp": {
|
|
188
|
+
"default": "./exp.js"
|
|
189
|
+
},
|
|
190
|
+
"./exp2": {
|
|
191
|
+
"default": "./exp2.js"
|
|
192
|
+
},
|
|
193
|
+
"./filtered-indices": {
|
|
194
|
+
"default": "./filtered-indices.js"
|
|
195
|
+
},
|
|
196
|
+
"./format": {
|
|
197
|
+
"default": "./format.js"
|
|
198
|
+
},
|
|
199
|
+
"./identity": {
|
|
200
|
+
"default": "./identity.js"
|
|
201
|
+
},
|
|
202
|
+
"./integrate": {
|
|
203
|
+
"default": "./integrate.js"
|
|
204
|
+
},
|
|
205
|
+
"./kernels": {
|
|
206
|
+
"default": "./kernels.js"
|
|
207
|
+
},
|
|
208
|
+
"./log": {
|
|
209
|
+
"default": "./log.js"
|
|
210
|
+
},
|
|
211
|
+
"./log2": {
|
|
212
|
+
"default": "./log2.js"
|
|
213
|
+
},
|
|
214
|
+
"./mag": {
|
|
215
|
+
"default": "./mag.js"
|
|
216
|
+
},
|
|
217
|
+
"./magsq": {
|
|
218
|
+
"default": "./magsq.js"
|
|
219
|
+
},
|
|
220
|
+
"./max": {
|
|
221
|
+
"default": "./max.js"
|
|
222
|
+
},
|
|
223
|
+
"./maxn": {
|
|
224
|
+
"default": "./maxn.js"
|
|
225
|
+
},
|
|
226
|
+
"./mean": {
|
|
227
|
+
"default": "./mean.js"
|
|
228
|
+
},
|
|
229
|
+
"./min": {
|
|
230
|
+
"default": "./min.js"
|
|
231
|
+
},
|
|
232
|
+
"./minn": {
|
|
233
|
+
"default": "./minn.js"
|
|
234
|
+
},
|
|
235
|
+
"./mul": {
|
|
236
|
+
"default": "./mul.js"
|
|
237
|
+
},
|
|
238
|
+
"./mulm": {
|
|
239
|
+
"default": "./mulm.js"
|
|
240
|
+
},
|
|
241
|
+
"./muln": {
|
|
242
|
+
"default": "./muln.js"
|
|
243
|
+
},
|
|
244
|
+
"./mulv": {
|
|
245
|
+
"default": "./mulv.js"
|
|
246
|
+
},
|
|
247
|
+
"./normalize": {
|
|
248
|
+
"default": "./normalize.js"
|
|
249
|
+
},
|
|
250
|
+
"./pow": {
|
|
251
|
+
"default": "./pow.js"
|
|
252
|
+
},
|
|
253
|
+
"./pown": {
|
|
254
|
+
"default": "./pown.js"
|
|
255
|
+
},
|
|
256
|
+
"./product": {
|
|
257
|
+
"default": "./product.js"
|
|
258
|
+
},
|
|
259
|
+
"./rand-distrib": {
|
|
260
|
+
"default": "./rand-distrib.js"
|
|
261
|
+
},
|
|
262
|
+
"./range": {
|
|
263
|
+
"default": "./range.js"
|
|
264
|
+
},
|
|
265
|
+
"./relu": {
|
|
266
|
+
"default": "./relu.js"
|
|
267
|
+
},
|
|
268
|
+
"./relun": {
|
|
269
|
+
"default": "./relun.js"
|
|
270
|
+
},
|
|
271
|
+
"./sample": {
|
|
272
|
+
"default": "./sample.js"
|
|
273
|
+
},
|
|
274
|
+
"./select": {
|
|
275
|
+
"default": "./select.js"
|
|
276
|
+
},
|
|
277
|
+
"./set": {
|
|
278
|
+
"default": "./set.js"
|
|
279
|
+
},
|
|
280
|
+
"./setn": {
|
|
281
|
+
"default": "./setn.js"
|
|
282
|
+
},
|
|
283
|
+
"./sigmoid": {
|
|
284
|
+
"default": "./sigmoid.js"
|
|
285
|
+
},
|
|
286
|
+
"./sin": {
|
|
287
|
+
"default": "./sin.js"
|
|
288
|
+
},
|
|
289
|
+
"./smoothstep": {
|
|
290
|
+
"default": "./smoothstep.js"
|
|
291
|
+
},
|
|
292
|
+
"./smoothstepn": {
|
|
293
|
+
"default": "./smoothstepn.js"
|
|
294
|
+
},
|
|
295
|
+
"./softmax": {
|
|
296
|
+
"default": "./softmax.js"
|
|
297
|
+
},
|
|
298
|
+
"./softplus": {
|
|
299
|
+
"default": "./softplus.js"
|
|
300
|
+
},
|
|
301
|
+
"./sqrt": {
|
|
302
|
+
"default": "./sqrt.js"
|
|
303
|
+
},
|
|
304
|
+
"./step": {
|
|
305
|
+
"default": "./step.js"
|
|
306
|
+
},
|
|
307
|
+
"./stepn": {
|
|
308
|
+
"default": "./stepn.js"
|
|
309
|
+
},
|
|
310
|
+
"./storage": {
|
|
311
|
+
"default": "./storage.js"
|
|
312
|
+
},
|
|
313
|
+
"./sub": {
|
|
314
|
+
"default": "./sub.js"
|
|
315
|
+
},
|
|
316
|
+
"./subn": {
|
|
317
|
+
"default": "./subn.js"
|
|
318
|
+
},
|
|
319
|
+
"./sum": {
|
|
320
|
+
"default": "./sum.js"
|
|
321
|
+
},
|
|
322
|
+
"./svd": {
|
|
323
|
+
"default": "./svd.js"
|
|
324
|
+
},
|
|
325
|
+
"./swap": {
|
|
326
|
+
"default": "./swap.js"
|
|
327
|
+
},
|
|
328
|
+
"./tan": {
|
|
329
|
+
"default": "./tan.js"
|
|
330
|
+
},
|
|
331
|
+
"./tanh": {
|
|
332
|
+
"default": "./tanh.js"
|
|
333
|
+
},
|
|
334
|
+
"./tensor": {
|
|
335
|
+
"default": "./tensor.js"
|
|
336
|
+
},
|
|
337
|
+
"./top": {
|
|
338
|
+
"default": "./top.js"
|
|
339
|
+
}
|
|
340
|
+
},
|
|
341
|
+
"thi.ng": {
|
|
342
|
+
"status": "alpha",
|
|
343
|
+
"year": 2018
|
|
344
|
+
},
|
|
345
|
+
"gitHead": "136a5e5ef0b69e82329db00d806c3c4e8f1aa063\n"
|
|
346
|
+
}
|
package/sample.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Fn2, Fn3, Fn4, Fn5, FnN, FnN2 } from "@thi.ng/api";
|
|
2
|
+
import type { ITensor } from "./api.js";
|
|
3
|
+
import { type Tensor1 } from "./tensor.js";
|
|
4
|
+
type BoundaryFn = FnN2;
|
|
5
|
+
type Sampler1 = Fn2<ITensor, number, number>;
|
|
6
|
+
type Sampler2 = Fn3<ITensor, number, number, number>;
|
|
7
|
+
type Sampler3 = Fn4<ITensor, number, number, number, number>;
|
|
8
|
+
type Sampler4 = Fn5<ITensor, number, number, number, number, number>;
|
|
9
|
+
type BoundaryType = "clamp" | "mirror" | "wrap" | "zero";
|
|
10
|
+
type SamplerType = "nearest" | "linear" | "cubic" | "lanczos";
|
|
11
|
+
interface SamplerKernel {
|
|
12
|
+
radius: number;
|
|
13
|
+
weight: FnN;
|
|
14
|
+
}
|
|
15
|
+
export declare const SAMPLE_NEAREST: SamplerKernel;
|
|
16
|
+
export declare const SAMPLE_LINEAR: SamplerKernel;
|
|
17
|
+
export declare const SAMPLE_CUBIC: SamplerKernel;
|
|
18
|
+
export declare const SAMPLE_LANCZOS: (r?: number) => SamplerKernel;
|
|
19
|
+
export declare const defSampler1: (kernel: SamplerKernel | SamplerType, boundary?: BoundaryFn | BoundaryType) => Sampler1;
|
|
20
|
+
export declare const defSampler2: (kernel: SamplerType | SamplerKernel | [SamplerType | SamplerKernel, SamplerType | SamplerKernel], boundary?: BoundaryType | BoundaryFn | [BoundaryType | BoundaryFn, BoundaryType | BoundaryFn]) => Sampler2;
|
|
21
|
+
export declare const defSampler3: (kernel: SamplerType | SamplerKernel | [SamplerType | SamplerKernel, SamplerType | SamplerKernel, SamplerType | SamplerKernel], boundary?: BoundaryType | BoundaryFn | [BoundaryType | BoundaryFn, BoundaryType | BoundaryFn, BoundaryType | BoundaryFn]) => Sampler3;
|
|
22
|
+
export declare const defSampler4: (kernel: SamplerType | SamplerKernel | [SamplerType | SamplerKernel, SamplerType | SamplerKernel, SamplerType | SamplerKernel, SamplerType | SamplerKernel], boundary?: BoundaryType | BoundaryFn | [BoundaryType | BoundaryFn, BoundaryType | BoundaryFn, BoundaryType | BoundaryFn, BoundaryType | BoundaryFn]) => Sampler4;
|
|
23
|
+
export declare const resample1: (out: Tensor1, a: Tensor1, sampler: Sampler1) => Tensor1<number>;
|
|
24
|
+
export declare const resample2: (out: ITensor, a: ITensor, [samplerX, samplerY]: Sampler1[]) => ITensor<number>;
|
|
25
|
+
export declare const resample3: (out: ITensor, a: ITensor, [samplerX, samplerY, samplerZ]: Sampler1[]) => ITensor<number>;
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=sample.d.ts.map
|
package/sample.js
ADDED
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
import { isArray } from "@thi.ng/checks/is-array";
|
|
2
|
+
import { isString } from "@thi.ng/checks/is-string";
|
|
3
|
+
import { PI } from "@thi.ng/math/api";
|
|
4
|
+
import { clamp } from "@thi.ng/math/interval";
|
|
5
|
+
import { tensor } from "./tensor.js";
|
|
6
|
+
const { abs, floor, sin } = Math;
|
|
7
|
+
const __boundaryClamp = (i, max) => clamp(i, 0, max - 1);
|
|
8
|
+
const __boundaryWrap = (i, max) => (i % max + max) % max;
|
|
9
|
+
const __boundaryMirror = (i, max) => {
|
|
10
|
+
if (max === 1) return 0;
|
|
11
|
+
const period = 2 * (max - 1);
|
|
12
|
+
i = (i % period + period) % period;
|
|
13
|
+
return i < max ? i : period - i;
|
|
14
|
+
};
|
|
15
|
+
const __boundaryZero = (i, max) => i >= 0 || i < max ? i : -1;
|
|
16
|
+
const BOUNDARY_MODES = {
|
|
17
|
+
clamp: __boundaryClamp,
|
|
18
|
+
wrap: __boundaryWrap,
|
|
19
|
+
mirror: __boundaryMirror,
|
|
20
|
+
zero: __boundaryZero
|
|
21
|
+
};
|
|
22
|
+
const SAMPLE_NEAREST = {
|
|
23
|
+
radius: 1,
|
|
24
|
+
weight: (t) => t >= -0.5 && t < 0.5 ? 1 : 0
|
|
25
|
+
};
|
|
26
|
+
const SAMPLE_LINEAR = {
|
|
27
|
+
radius: 1,
|
|
28
|
+
weight: (t) => {
|
|
29
|
+
t = abs(t);
|
|
30
|
+
return t < 1 ? 1 - t : 0;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
const SAMPLE_CUBIC = {
|
|
34
|
+
radius: 2,
|
|
35
|
+
weight: (t) => {
|
|
36
|
+
t = abs(t);
|
|
37
|
+
const a = -0.5;
|
|
38
|
+
return t < 2 ? t <= 1 ? ((a + 2) * t - (a + 3)) * t * t + 1 : ((a * t - 5 * a) * t + 8 * a) * t - 4 * a : 0;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
const SAMPLE_LANCZOS = (r = 2) => ({
|
|
42
|
+
radius: r,
|
|
43
|
+
weight: (t) => {
|
|
44
|
+
if (t === 0) return 1;
|
|
45
|
+
if (t > -r && t < r) {
|
|
46
|
+
t *= PI;
|
|
47
|
+
return r * sin(t) * sin(t / r) / (t * t);
|
|
48
|
+
}
|
|
49
|
+
return 0;
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
const SAMPLER_TYPES = {
|
|
53
|
+
nearest: SAMPLE_NEAREST,
|
|
54
|
+
linear: SAMPLE_LINEAR,
|
|
55
|
+
cubic: SAMPLE_CUBIC,
|
|
56
|
+
lanczos: SAMPLE_LANCZOS(2)
|
|
57
|
+
};
|
|
58
|
+
const defSampler1 = (kernel, boundary = "clamp") => {
|
|
59
|
+
const index = __resolveBoundary(boundary);
|
|
60
|
+
const { radius, weight } = __resolveKernel(kernel);
|
|
61
|
+
return ({ data, shape: [sx], stride: [tx], offset }, x) => {
|
|
62
|
+
const c = floor(x);
|
|
63
|
+
let sum = 0;
|
|
64
|
+
let wsum = 0;
|
|
65
|
+
for (let k = -radius; k <= radius; k++) {
|
|
66
|
+
const $x = c + k;
|
|
67
|
+
const w = weight(x - $x);
|
|
68
|
+
if (w === 0) continue;
|
|
69
|
+
const i = index($x, sx);
|
|
70
|
+
if (i < 0) {
|
|
71
|
+
wsum += w;
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
sum += data[offset + i * tx] * w;
|
|
75
|
+
wsum += w;
|
|
76
|
+
}
|
|
77
|
+
return wsum !== 0 ? sum / wsum : 0;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
const defSampler2 = (kernel, boundary = "clamp") => {
|
|
81
|
+
const [indexX, indexY] = (isArray(boundary) ? boundary : [boundary, boundary]).map(__resolveBoundary);
|
|
82
|
+
const [kernelX, kernelY] = isArray(kernel) ? kernel : [kernel, kernel];
|
|
83
|
+
const { radius: rx, weight: weightX } = __resolveKernel(kernelX);
|
|
84
|
+
const { radius: ry, weight: weightY } = __resolveKernel(kernelY);
|
|
85
|
+
const sizeY = 2 * ry + 1;
|
|
86
|
+
const cacheY = new Array(sizeY);
|
|
87
|
+
return ({ data, shape: [sx, sy], stride: [tx, ty], offset }, x, y) => {
|
|
88
|
+
const cx = floor(x);
|
|
89
|
+
const cy = floor(y);
|
|
90
|
+
let sum = 0;
|
|
91
|
+
let wsum = 0;
|
|
92
|
+
for (let i = 0; i < sizeY; i++) {
|
|
93
|
+
cacheY[i] = weightY(y - (cy + i - ry));
|
|
94
|
+
}
|
|
95
|
+
for (let kx = -rx; kx <= rx; kx++) {
|
|
96
|
+
const $x = cx + kx;
|
|
97
|
+
const ix = indexX($x, sx);
|
|
98
|
+
const wx = weightX(x - $x);
|
|
99
|
+
const idx = offset + ix * tx;
|
|
100
|
+
for (let ky = -ry; ky <= ry; ky++) {
|
|
101
|
+
const wy = cacheY[ky + ry];
|
|
102
|
+
const weight = wx * wy;
|
|
103
|
+
if (weight === 0) continue;
|
|
104
|
+
const iy = indexY(cy + ky, sy);
|
|
105
|
+
if (ix < 0 || iy < 0) {
|
|
106
|
+
wsum += weight;
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
sum += data[idx + iy * ty] * weight;
|
|
110
|
+
wsum += weight;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return wsum !== 0 ? sum / wsum : 0;
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
const defSampler3 = (kernel, boundary = "clamp") => {
|
|
117
|
+
const [indexX, indexY, indexZ] = (isArray(boundary) ? boundary : [boundary, boundary, boundary]).map(__resolveBoundary);
|
|
118
|
+
const [kernelX, kernelY, kernelZ] = (isArray(kernel) ? kernel : [kernel, kernel, kernel]).map(__resolveKernel);
|
|
119
|
+
const { radius: rx, weight: weightX } = kernelX;
|
|
120
|
+
const { radius: ry, weight: weightY } = kernelY;
|
|
121
|
+
const { radius: rz, weight: weightZ } = kernelZ;
|
|
122
|
+
const sizeY = 2 * ry + 1;
|
|
123
|
+
const sizeZ = 2 * rz + 1;
|
|
124
|
+
const cacheY = new Array(sizeY);
|
|
125
|
+
const cacheZ = new Array(sizeZ);
|
|
126
|
+
return ({ data, shape: [sx, sy, sz], stride: [tx, ty, tz], offset }, x, y, z) => {
|
|
127
|
+
const cx = floor(x);
|
|
128
|
+
const cy = floor(y);
|
|
129
|
+
const cz = floor(z);
|
|
130
|
+
let sum = 0;
|
|
131
|
+
let wsum = 0;
|
|
132
|
+
for (let i = 0; i < sizeY; i++) cacheY[i] = weightY(y - (cy + i - ry));
|
|
133
|
+
for (let i = 0; i < sizeZ; i++) cacheZ[i] = weightZ(z - (cz + i - rz));
|
|
134
|
+
for (let kx = -rx; kx <= rx; kx++) {
|
|
135
|
+
const $x = cx + kx;
|
|
136
|
+
const ix = indexX($x, sx);
|
|
137
|
+
const wx = weightX(x - $x);
|
|
138
|
+
const idxX = offset + ix * tx;
|
|
139
|
+
for (let ky = -ry; ky <= ry; ky++) {
|
|
140
|
+
const iy = indexY(cy + ky, sy);
|
|
141
|
+
const wy = cacheY[ky + ry];
|
|
142
|
+
const idxXY = idxX + iy * ty;
|
|
143
|
+
for (let kz = -rz; kz <= rz; kz++) {
|
|
144
|
+
const wz = cacheZ[kz + rz];
|
|
145
|
+
const weight = wx * wy * wz;
|
|
146
|
+
if (weight === 0) continue;
|
|
147
|
+
const iz = indexZ(cz + kz, sz);
|
|
148
|
+
if (ix < 0 || iy < 0 || iz < 0) {
|
|
149
|
+
wsum += weight;
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
sum += data[idxXY + iz * tz] * weight;
|
|
153
|
+
wsum += weight;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return wsum !== 0 ? sum / wsum : 0;
|
|
158
|
+
};
|
|
159
|
+
};
|
|
160
|
+
const defSampler4 = (kernel, boundary = "clamp") => {
|
|
161
|
+
const [indexX, indexY, indexZ, indexW] = (isArray(boundary) ? boundary : [boundary, boundary, boundary, boundary]).map(__resolveBoundary);
|
|
162
|
+
const [kernelX, kernelY, kernelZ, kernelW] = (isArray(kernel) ? kernel : [kernel, kernel, kernel, kernel]).map(__resolveKernel);
|
|
163
|
+
const { radius: rx, weight: weightX } = kernelX;
|
|
164
|
+
const { radius: ry, weight: weightY } = kernelY;
|
|
165
|
+
const { radius: rz, weight: weightZ } = kernelZ;
|
|
166
|
+
const { radius: rw, weight: weightW } = kernelW;
|
|
167
|
+
const sizeY = 2 * ry + 1;
|
|
168
|
+
const sizeZ = 2 * rz + 1;
|
|
169
|
+
const sizeW = 2 * rw + 1;
|
|
170
|
+
const cacheY = new Array(sizeY);
|
|
171
|
+
const cacheZ = new Array(sizeZ);
|
|
172
|
+
const cacheW = new Array(sizeW);
|
|
173
|
+
return ({ data, shape: [sx, sy, sz, sw], stride: [tx, ty, tz, tw], offset }, x, y, z, w) => {
|
|
174
|
+
const cx = floor(x);
|
|
175
|
+
const cy = floor(y);
|
|
176
|
+
const cz = floor(z);
|
|
177
|
+
const cw = floor(w);
|
|
178
|
+
let sum = 0;
|
|
179
|
+
let wsum = 0;
|
|
180
|
+
for (let i = 0; i < sizeY; i++) cacheY[i] = weightY(y - (cy + i - ry));
|
|
181
|
+
for (let i = 0; i < sizeZ; i++) cacheZ[i] = weightZ(z - (cz + i - rz));
|
|
182
|
+
for (let i = 0; i < sizeW; i++) cacheW[i] = weightW(w - (cw + i - rw));
|
|
183
|
+
for (let kx = -rx; kx <= rx; kx++) {
|
|
184
|
+
const $x = cx + kx;
|
|
185
|
+
const ix = indexX($x, sx);
|
|
186
|
+
const wx = weightX(x - $x);
|
|
187
|
+
const idxX = offset + ix * tx;
|
|
188
|
+
for (let ky = -ry; ky <= ry; ky++) {
|
|
189
|
+
const iy = indexY(cy + ky, sy);
|
|
190
|
+
const wy = cacheY[ky + ry];
|
|
191
|
+
const idxXY = idxX + iy * ty;
|
|
192
|
+
for (let kz = -rz; kz <= rz; kz++) {
|
|
193
|
+
const wz = cacheZ[kz + rz];
|
|
194
|
+
const iz = indexZ(cz + kz, sz);
|
|
195
|
+
const idxXYZ = idxXY + iz * tz;
|
|
196
|
+
for (let kw = -rw; kw <= rw; kw++) {
|
|
197
|
+
const ww = cacheW[kw + rw];
|
|
198
|
+
const weight = wx * wy * wz * ww;
|
|
199
|
+
if (weight === 0) continue;
|
|
200
|
+
const iw = indexW(cw + kw, sw);
|
|
201
|
+
if (ix < 0 || iy < 0 || iz < 0 || iw < 0) {
|
|
202
|
+
wsum += weight;
|
|
203
|
+
continue;
|
|
204
|
+
}
|
|
205
|
+
sum += data[idxXYZ + iw * tw] * weight;
|
|
206
|
+
wsum += w;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
return wsum !== 0 ? sum / wsum : 0;
|
|
212
|
+
};
|
|
213
|
+
};
|
|
214
|
+
const __resolveBoundary = (mode) => isString(mode) ? BOUNDARY_MODES[mode] : mode ?? __boundaryClamp;
|
|
215
|
+
const __resolveKernel = (kernel) => isString(kernel) ? SAMPLER_TYPES[kernel] : kernel;
|
|
216
|
+
const resample1 = (out, a, sampler) => {
|
|
217
|
+
const {
|
|
218
|
+
data: odata,
|
|
219
|
+
shape: [sxo],
|
|
220
|
+
stride: [txo],
|
|
221
|
+
offset: oo
|
|
222
|
+
} = out;
|
|
223
|
+
const {
|
|
224
|
+
shape: [sxa]
|
|
225
|
+
} = a;
|
|
226
|
+
const scale = sxa / sxo;
|
|
227
|
+
for (let i = 0; i < sxo; i++) {
|
|
228
|
+
odata[oo + i * txo] = sampler(a, (i + 0.5) * scale - 0.5);
|
|
229
|
+
}
|
|
230
|
+
return out;
|
|
231
|
+
};
|
|
232
|
+
const resample2 = (out, a, [samplerX, samplerY]) => {
|
|
233
|
+
const {
|
|
234
|
+
shape: [_, syo]
|
|
235
|
+
} = out;
|
|
236
|
+
const {
|
|
237
|
+
shape: [sxa]
|
|
238
|
+
} = a;
|
|
239
|
+
const tmp = tensor("num", [sxa, syo]);
|
|
240
|
+
for (let x = 0; x < sxa; x++) {
|
|
241
|
+
resample1(tmp.pick([x, -1]), a.pick([x, -1]), samplerX);
|
|
242
|
+
}
|
|
243
|
+
for (let y = 0; y < syo; y++) {
|
|
244
|
+
resample1(out.pick([-1, y]), tmp.pick([-1, y]), samplerY);
|
|
245
|
+
}
|
|
246
|
+
return out;
|
|
247
|
+
};
|
|
248
|
+
const resample3 = (out, a, [samplerX, samplerY, samplerZ]) => {
|
|
249
|
+
const {
|
|
250
|
+
shape: [_, syo, szo]
|
|
251
|
+
} = out;
|
|
252
|
+
const {
|
|
253
|
+
shape: [sxa, sya]
|
|
254
|
+
} = a;
|
|
255
|
+
const tmpX = tensor("num", [sxa, sya, szo]);
|
|
256
|
+
for (let i = 0; i < sxa; i++) {
|
|
257
|
+
const src = a.pick([i]);
|
|
258
|
+
const dest = tmpX.pick([i]);
|
|
259
|
+
for (let j = 0; j < sya; j++) {
|
|
260
|
+
resample1(dest.pick([j]), src.pick([j]), samplerX);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
const tmpY = tensor("num", [sxa, syo, szo]);
|
|
264
|
+
for (let i = 0; i < sxa; i++) {
|
|
265
|
+
const src = tmpX.pick([i]);
|
|
266
|
+
const dest = tmpY.pick([i]);
|
|
267
|
+
for (let j = 0; j < szo; j++) {
|
|
268
|
+
resample1(dest.pick([-1, j]), src.pick([-1, j]), samplerY);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
for (let i = 0; i < syo; i++) {
|
|
272
|
+
for (let j = 0; j < szo; j++) {
|
|
273
|
+
resample1(out.pick([-1, i, j]), tmpY.pick([-1, i, j]), samplerZ);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
return out;
|
|
277
|
+
};
|
|
278
|
+
export {
|
|
279
|
+
SAMPLE_CUBIC,
|
|
280
|
+
SAMPLE_LANCZOS,
|
|
281
|
+
SAMPLE_LINEAR,
|
|
282
|
+
SAMPLE_NEAREST,
|
|
283
|
+
defSampler1,
|
|
284
|
+
defSampler2,
|
|
285
|
+
defSampler3,
|
|
286
|
+
defSampler4,
|
|
287
|
+
resample1,
|
|
288
|
+
resample2,
|
|
289
|
+
resample3
|
|
290
|
+
};
|
package/CHANGELOG.md
DELETED
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
# Change Log
|
|
2
|
-
|
|
3
|
-
- **Last updated**: 2025-08-16T18:12:02Z
|
|
4
|
-
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
|
|
5
|
-
|
|
6
|
-
All notable changes to this project will be documented in this file.
|
|
7
|
-
Only versions published since **2022-01-01** are listed here.
|
|
8
|
-
Please consult the Git history for older version information.
|
|
9
|
-
See [Conventional Commits](https://conventionalcommits.org/) for commit guidelines.
|
|
10
|
-
|
|
11
|
-
**Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
|
|
12
|
-
and/or version bumps of transitive dependencies.
|
|
13
|
-
|
|
14
|
-
## [0.9.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/tensors@0.9.0) (2025-08-16)
|
|
15
|
-
|
|
16
|
-
#### 🚀 Features
|
|
17
|
-
|
|
18
|
-
- add 0-dim (wrapped scalar) tensor support ([cd22ee6](https://github.com/thi-ng/umbrella/commit/cd22ee6))
|
|
19
|
-
- add `Tensor0`, `Shape0`
|
|
20
|
-
- update HOF tensor op generators
|
|
21
|
-
- add/update tests
|
|
22
|
-
|
|
23
|
-
## [0.8.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/tensors@0.8.0) (2025-07-10)
|
|
24
|
-
|
|
25
|
-
#### 🚀 Features
|
|
26
|
-
|
|
27
|
-
- add `step()`/`smoothStep()` variations ([b433462](https://github.com/thi-ng/umbrella/commit/b433462))
|
|
28
|
-
- add ITensor.crop() ([77e294d](https://github.com/thi-ng/umbrella/commit/77e294d))
|
|
29
|
-
|
|
30
|
-
## [0.7.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/tensors@0.7.0) (2025-07-09)
|
|
31
|
-
|
|
32
|
-
#### 🚀 Features
|
|
33
|
-
|
|
34
|
-
- add `integrate()` tensor op ([fe39a4a](https://github.com/thi-ng/umbrella/commit/fe39a4a))
|
|
35
|
-
- add `TensorLike` and `asTensor()` ([f76d9a6](https://github.com/thi-ng/umbrella/commit/f76d9a6))
|
|
36
|
-
|
|
37
|
-
#### ♻️ Refactoring
|
|
38
|
-
|
|
39
|
-
- migrate `asTensor()` to convert.ts ([fcb83c5](https://github.com/thi-ng/umbrella/commit/fcb83c5))
|
|
40
|
-
|
|
41
|
-
## [0.6.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/tensors@0.6.0) (2025-06-05)
|
|
42
|
-
|
|
43
|
-
#### 🚀 Features
|
|
44
|
-
|
|
45
|
-
- update defOpRT()/defOpRTT() ([8099abc](https://github.com/thi-ng/umbrella/commit/8099abc))
|
|
46
|
-
- add optional `complete` fn to produce/transform final result (reducer like)
|
|
47
|
-
- add mean() tensor op ([2f15d21](https://github.com/thi-ng/umbrella/commit/2f15d21))
|
|
48
|
-
|
|
49
|
-
## [0.5.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/tensors@0.5.0) (2025-05-28)
|
|
50
|
-
|
|
51
|
-
#### 🚀 Features
|
|
52
|
-
|
|
53
|
-
- add convolve() (1D/2D/3D versions) ([bc9a6eb](https://github.com/thi-ng/umbrella/commit/bc9a6eb))
|
|
54
|
-
- add `constant()`, refactor `ones()` ([8cdd68c](https://github.com/thi-ng/umbrella/commit/8cdd68c))
|
|
55
|
-
- add convolution kernel presets ([e553f06](https://github.com/thi-ng/umbrella/commit/e553f06))
|
|
56
|
-
- add 1D/2D/3D sobel kernels
|
|
57
|
-
- add 2D box blur
|
|
58
|
-
- add 2D gaussian blur
|
|
59
|
-
- add/update/rename convolution kernels ([025c7ba](https://github.com/thi-ng/umbrella/commit/025c7ba))
|
|
60
|
-
- add `applyKernel()`, add/update kernel presets ([b8c2a7a](https://github.com/thi-ng/umbrella/commit/b8c2a7a))
|
|
61
|
-
- add `fromFloatBuffer()` conversion ([d78a0d3](https://github.com/thi-ng/umbrella/commit/d78a0d3))
|
|
62
|
-
|
|
63
|
-
## [0.4.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/tensors@0.4.0) (2025-05-12)
|
|
64
|
-
|
|
65
|
-
#### 🚀 Features
|
|
66
|
-
|
|
67
|
-
- add release() handling for tensors ([da06312](https://github.com/thi-ng/umbrella/commit/da06312))
|
|
68
|
-
- add data type support for range() options ([90d02bc](https://github.com/thi-ng/umbrella/commit/90d02bc))
|
|
69
|
-
|
|
70
|
-
## [0.3.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/tensors@0.3.0) (2025-05-08)
|
|
71
|
-
|
|
72
|
-
#### 🚀 Features
|
|
73
|
-
|
|
74
|
-
- add swap(), update defOpRT/TT() fns ([5d2dd2a](https://github.com/thi-ng/umbrella/commit/5d2dd2a))
|
|
75
|
-
- add range() tensor factory ([a8a6365](https://github.com/thi-ng/umbrella/commit/a8a6365))
|
|
76
|
-
- add ITensor.position() & impls ([595764d](https://github.com/thi-ng/umbrella/commit/595764d))
|
|
77
|
-
- add filteredIndices() & presets ([edd8983](https://github.com/thi-ng/umbrella/commit/edd8983))
|
|
78
|
-
- add nonZeroIndices()
|
|
79
|
-
- add negativeIndices(), positiveIndices()
|
|
80
|
-
|
|
81
|
-
#### 🩹 Bug fixes
|
|
82
|
-
|
|
83
|
-
- update ITensor.broadcast() return type ([f7b2e7a](https://github.com/thi-ng/umbrella/commit/f7b2e7a))
|
|
84
|
-
|
|
85
|
-
#### ♻️ Refactoring
|
|
86
|
-
|
|
87
|
-
- update range() impl (w/o dependencies) ([ce89d71](https://github.com/thi-ng/umbrella/commit/ce89d71))
|
|
88
|
-
|
|
89
|
-
## [0.2.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/tensors@0.2.0) (2025-05-02)
|
|
90
|
-
|
|
91
|
-
#### 🚀 Features
|
|
92
|
-
|
|
93
|
-
- add `zeroes()`/`ones()` ([eb6f82d](https://github.com/thi-ng/umbrella/commit/eb6f82d))
|
|
94
|
-
- add singular value decomp `svd()` ([8902157](https://github.com/thi-ng/umbrella/commit/8902157))
|
|
95
|
-
- add `diagonal()` and `trace()` fns ([47a0e73](https://github.com/thi-ng/umbrella/commit/47a0e73))
|
|
96
|
-
- add broadcast(), add ITensor.broadcast() ([b9b2dfc](https://github.com/thi-ng/umbrella/commit/b9b2dfc))
|
|
97
|
-
- update all tensor ops & op generators ([47b3e4e](https://github.com/thi-ng/umbrella/commit/47b3e4e))
|
|
98
|
-
- add broadcasting support where possible
|
|
99
|
-
- update all `defOpXXX` HOF generators
|
|
100
|
-
- replace & remove various `TensorOpXXX` function types
|
|
101
|
-
- update all tensor ops, only keep one version per op
|
|
102
|
-
- update doc strings
|
|
103
|
-
|
|
104
|
-
#### 🩹 Bug fixes
|
|
105
|
-
|
|
106
|
-
- add missing `randDistrib4()` ([eb2ded2](https://github.com/thi-ng/umbrella/commit/eb2ded2))
|
|
107
|
-
|
|
108
|
-
#### ♻️ Refactoring
|
|
109
|
-
|
|
110
|
-
- update internal local var handling in various tensor ops ([c02c2a6](https://github.com/thi-ng/umbrella/commit/c02c2a6))
|
|
111
|
-
- internal updates dot(), identity(), select() ([c0ed334](https://github.com/thi-ng/umbrella/commit/c0ed334))
|
|
112
|
-
- update top() return type ([dcab223](https://github.com/thi-ng/umbrella/commit/dcab223))
|
|
113
|
-
|
|
114
|
-
## [0.1.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/tensors@0.1.0) (2025-04-30)
|
|
115
|
-
|
|
116
|
-
#### 🚀 Features
|
|
117
|
-
|
|
118
|
-
- initial import (old code, needs update) ([dc4f2b4](https://github.com/thi-ng/umbrella/commit/dc4f2b4))
|
|
119
|
-
- major updates & refactoring/cleanup ([49249a9](https://github.com/thi-ng/umbrella/commit/49249a9))
|
|
120
|
-
- update & restructure defOpXX() fns ([a96ecf8](https://github.com/thi-ng/umbrella/commit/a96ecf8))
|
|
121
|
-
- update TensorOpts and tensor factory fn, add docs ([21b8d48](https://github.com/thi-ng/umbrella/commit/21b8d48))
|
|
122
|
-
- update/replace tensor op generators, add op types ([2a00949](https://github.com/thi-ng/umbrella/commit/2a00949))
|
|
123
|
-
- add first set of common math ops ([00c02c1](https://github.com/thi-ng/umbrella/commit/00c02c1))
|
|
124
|
-
- add matrix-vector multiply, add custom error type ([a005276](https://github.com/thi-ng/umbrella/commit/a005276))
|
|
125
|
-
- add `identity()` factory fn ([1f2e914](https://github.com/thi-ng/umbrella/commit/1f2e914))
|
|
126
|
-
- add defOpRT(), add product/sum reducers ([19b6a9a](https://github.com/thi-ng/umbrella/commit/19b6a9a))
|
|
127
|
-
- add exp, log, softMax ops, update pkg exports ([465b0d2](https://github.com/thi-ng/umbrella/commit/465b0d2))
|
|
128
|
-
- add various math ops ([9e385ad](https://github.com/thi-ng/umbrella/commit/9e385ad))
|
|
129
|
-
- add/update various math ops, types, op factories ([a64468e](https://github.com/thi-ng/umbrella/commit/a64468e))
|
|
130
|
-
- add select(), argMin, argMax() fns ([fa508e1](https://github.com/thi-ng/umbrella/commit/fa508e1))
|
|
131
|
-
- add `print()` helper ([6c2e347](https://github.com/thi-ng/umbrella/commit/6c2e347))
|
|
132
|
-
- rename existing fn => `debug()`
|
|
133
|
-
- add softPlus() op ([1d85630](https://github.com/thi-ng/umbrella/commit/1d85630))
|
|
134
|
-
- add 4D tensor support & ops ([e3c9a0f](https://github.com/thi-ng/umbrella/commit/e3c9a0f))
|
|
135
|
-
- add exp2(), log2() ops ([18544a4](https://github.com/thi-ng/umbrella/commit/18544a4))
|
|
136
|
-
- update tensor(), add tensorFromArray(), add types/generics ([204734d](https://github.com/thi-ng/umbrella/commit/204734d))
|
|
137
|
-
|
|
138
|
-
#### 🩹 Bug fixes
|
|
139
|
-
|
|
140
|
-
- fix tensor scalar ops ([a26309d](https://github.com/thi-ng/umbrella/commit/a26309d))
|
|
141
|
-
|
|
142
|
-
#### ♻️ Refactoring
|
|
143
|
-
|
|
144
|
-
- minor update mulM() ([8bec8d1](https://github.com/thi-ng/umbrella/commit/8bec8d1))
|
|
145
|
-
- deduplicate tensor impls ([5fac485](https://github.com/thi-ng/umbrella/commit/5fac485))
|
|
146
|
-
- minor internal update arg types ([be56f5a](https://github.com/thi-ng/umbrella/commit/be56f5a))
|