wasm-bhtsne 0.3.3 → 1.0.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.
- package/README.md +32 -18
- package/package.json +5 -5
- package/wasm_bhtsne.d.ts +140 -18
- package/wasm_bhtsne.js +391 -168
- package/wasm_bhtsne_bg.wasm +0 -0
package/README.md
CHANGED
|
@@ -3,25 +3,23 @@
|
|
|
3
3
|
<div align="center">
|
|
4
4
|
|
|
5
5
|
[](https://opensource.org/licenses/MIT)
|
|
6
|
-
|
|
7
6
|
</div>
|
|
8
7
|
|
|
8
|
+
|
|
9
9
|
This is the wasm version of the [bhtsne](https://github.com/frjnn/bhtsne) crate.
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
## Features
|
|
12
|
+
- Harnesses multi-threading capabilities through [wasm-bindgen-rayon](https://github.com/RReverser/wasm-bindgen-rayon).
|
|
13
13
|
|
|
14
14
|
## Installation
|
|
15
15
|
```shell
|
|
16
16
|
npm i wasm-bhtsne
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
## Example
|
|
20
20
|
|
|
21
21
|
```javascript
|
|
22
|
-
import
|
|
23
|
-
|
|
24
|
-
await init();
|
|
22
|
+
import { threads } from 'wasm-feature-detect';
|
|
25
23
|
|
|
26
24
|
function createRandomMatrix(rows, columns) {
|
|
27
25
|
return Array.from({ length: rows }, () =>
|
|
@@ -29,14 +27,30 @@ function createRandomMatrix(rows, columns) {
|
|
|
29
27
|
);
|
|
30
28
|
}
|
|
31
29
|
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
30
|
+
(async function initMultiThread() {
|
|
31
|
+
const multiThread = await import('./pkg-parallel/wasm_bhtsne.js');
|
|
32
|
+
await multiThread.default();
|
|
33
|
+
if (await threads()) {
|
|
34
|
+
console.log("Browser supports threads");
|
|
35
|
+
await multiThread.initThreadPool(navigator.hardwareConcurrency);
|
|
36
|
+
} else {
|
|
37
|
+
console.log("Browser does not support threads");
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
Object.assign(document.getElementById("wasm-bhtsne"), {
|
|
41
|
+
async onclick() {
|
|
42
|
+
|
|
43
|
+
// create random points and dimensions
|
|
44
|
+
const data = createRandomMatrix(500, 7);
|
|
45
|
+
|
|
46
|
+
let tsne_encoder = new multiThread.bhtSNE(data); // create a tSNE instance
|
|
47
|
+
tsne_encoder.perplexity = 25.0; // change hyperparameters
|
|
48
|
+
|
|
49
|
+
// run the algorithm with 1000 iterations
|
|
50
|
+
let compressed_vectors = tsne_encoder.step(1000);
|
|
51
|
+
console.log("Compressed Vectors:", compressed_vectors);
|
|
52
|
+
},
|
|
53
|
+
disabled: false
|
|
54
|
+
});
|
|
55
|
+
})();
|
|
56
|
+
```
|
package/package.json
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
"collaborators": [
|
|
4
4
|
"lv291 <baiunco291@proton.me>"
|
|
5
5
|
],
|
|
6
|
-
"description": "
|
|
7
|
-
"version": "0.
|
|
6
|
+
"description": "Barnes-Hut implementations of t-SNE in wasm",
|
|
7
|
+
"version": "1.0.0",
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"keywords": [
|
|
24
24
|
"tsne",
|
|
25
25
|
"data-visualization",
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
26
|
+
"webassembly",
|
|
27
|
+
"wasm",
|
|
28
|
+
"rust"
|
|
29
29
|
]
|
|
30
30
|
}
|
package/wasm_bhtsne.d.ts
CHANGED
|
@@ -1,52 +1,172 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
|
+
* @param {number} num_threads
|
|
5
|
+
* @returns {Promise<any>}
|
|
6
|
+
*/
|
|
7
|
+
export function initThreadPool(num_threads: number): Promise<any>;
|
|
8
|
+
/**
|
|
9
|
+
* @param {number} receiver
|
|
10
|
+
*/
|
|
11
|
+
export function wbg_rayon_start_worker(receiver: number): void;
|
|
12
|
+
/**
|
|
4
13
|
* t-distributed stochastic neighbor embedding. Provides a parallel implementation of both the
|
|
5
14
|
* exact version of the algorithm and the tree accelerated one leveraging space partitioning trees.
|
|
6
15
|
*/
|
|
7
|
-
export class
|
|
16
|
+
export class bhtSNE {
|
|
8
17
|
free(): void;
|
|
9
18
|
/**
|
|
10
|
-
* @param {
|
|
19
|
+
* @param {any} data
|
|
11
20
|
*/
|
|
12
|
-
constructor(
|
|
21
|
+
constructor(data: any);
|
|
13
22
|
/**
|
|
14
23
|
* Performs a parallel Barnes-Hut approximation of the t-SNE algorithm.
|
|
15
24
|
*
|
|
16
25
|
* # Arguments
|
|
17
26
|
*
|
|
18
|
-
*
|
|
27
|
+
* `epochs` - Sets epochs, the maximum number of fitting iterations.
|
|
28
|
+
* @param {number} epochs
|
|
29
|
+
* @returns {any}
|
|
30
|
+
*/
|
|
31
|
+
step(epochs: number): any;
|
|
32
|
+
/**
|
|
33
|
+
* Sets a new learning rate.
|
|
34
|
+
*
|
|
35
|
+
* # Arguments
|
|
36
|
+
*
|
|
37
|
+
* `learning_rate` - new value for the learning rate.
|
|
38
|
+
* @param {number} learning_rate
|
|
39
|
+
*/
|
|
40
|
+
learning_rate(learning_rate: number): void;
|
|
41
|
+
/**
|
|
42
|
+
* Sets new epochs, i.e the maximum number of fitting iterations.
|
|
43
|
+
*
|
|
44
|
+
* # Arguments
|
|
45
|
+
*
|
|
46
|
+
* `epochs` - new value for the epochs.
|
|
47
|
+
* @param {number} epochs
|
|
48
|
+
*/
|
|
49
|
+
epochs(epochs: number): void;
|
|
50
|
+
/**
|
|
51
|
+
* Sets a new momentum.
|
|
52
|
+
*
|
|
53
|
+
* # Arguments
|
|
54
|
+
*
|
|
55
|
+
* `momentum` - new value for the momentum.
|
|
56
|
+
* @param {number} momentum
|
|
57
|
+
*/
|
|
58
|
+
momentum(momentum: number): void;
|
|
59
|
+
/**
|
|
60
|
+
* Sets a new final momentum.
|
|
61
|
+
*
|
|
62
|
+
* # Arguments
|
|
63
|
+
*
|
|
64
|
+
* `final_momentum` - new value for the final momentum.
|
|
65
|
+
* @param {number} final_momentum
|
|
66
|
+
*/
|
|
67
|
+
final_momentum(final_momentum: number): void;
|
|
68
|
+
/**
|
|
69
|
+
* Sets a new momentum switch epoch, i.e. the epoch after which the algorithm switches to
|
|
70
|
+
* `final_momentum` for the map update.
|
|
71
|
+
*
|
|
72
|
+
* # Arguments
|
|
73
|
+
*
|
|
74
|
+
* `momentum_switch_epoch` - new value for the momentum switch epoch.
|
|
75
|
+
* @param {number} momentum_switch_epoch
|
|
76
|
+
*/
|
|
77
|
+
momentum_switch_epoch(momentum_switch_epoch: number): void;
|
|
78
|
+
/**
|
|
79
|
+
* Sets a new stop lying epoch, i.e. the epoch after which the P distribution values become
|
|
80
|
+
* true, as defined in the original implementation. For epochs < `stop_lying_epoch` the values
|
|
81
|
+
* of the P distribution are multiplied by a factor equal to `12.0`.
|
|
82
|
+
*
|
|
83
|
+
* # Arguments
|
|
84
|
+
*
|
|
85
|
+
* `stop_lying_epoch` - new value for the stop lying epoch.
|
|
86
|
+
* @param {number} stop_lying_epoch
|
|
87
|
+
*/
|
|
88
|
+
stop_lying_epoch(stop_lying_epoch: number): void;
|
|
89
|
+
/**
|
|
90
|
+
* Sets a new theta, which determines the accuracy of the approximation. Must be **strictly greater than
|
|
19
91
|
* 0.0**. Large values for θ increase the speed of the algorithm but decrease its accuracy.
|
|
20
92
|
* For small values of θ it is less probable that a cell in the space partitioning tree will
|
|
21
93
|
* be treated as a single point. For θ equal to 0.0 the method degenerates in the exact
|
|
22
94
|
* version.
|
|
23
95
|
*
|
|
24
|
-
*
|
|
96
|
+
* # Arguments
|
|
25
97
|
*
|
|
98
|
+
* * `theta` - new value for the theta.
|
|
99
|
+
* @param {number} theta
|
|
100
|
+
*/
|
|
101
|
+
theta(theta: number): void;
|
|
102
|
+
/**
|
|
103
|
+
* Sets a new value for the embedding dimension.
|
|
26
104
|
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* @
|
|
105
|
+
* # Arguments
|
|
106
|
+
*
|
|
107
|
+
* `embedding_dim` - new value for the embedding space dimensionality.
|
|
108
|
+
* @param {number} embedding_dim
|
|
109
|
+
*/
|
|
110
|
+
embedding_dim(embedding_dim: number): void;
|
|
111
|
+
/**
|
|
112
|
+
* Sets a new perplexity value.
|
|
113
|
+
*
|
|
114
|
+
* # Arguments
|
|
115
|
+
*
|
|
116
|
+
* `perplexity` - new value for the perplexity. It's used so that the bandwidth of the Gaussian
|
|
117
|
+
* kernels, is set in such a way that the perplexity of each the conditional distribution *Pi*
|
|
118
|
+
* equals a predefined perplexity *u*.
|
|
119
|
+
*
|
|
120
|
+
* A good value for perplexity lies between 5.0 and 50.0.
|
|
121
|
+
* @param {number} perplexity
|
|
122
|
+
*/
|
|
123
|
+
perplexity(perplexity: number): void;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
*/
|
|
127
|
+
export class wbg_rayon_PoolBuilder {
|
|
128
|
+
free(): void;
|
|
129
|
+
/**
|
|
130
|
+
* @returns {number}
|
|
131
|
+
*/
|
|
132
|
+
numThreads(): number;
|
|
133
|
+
/**
|
|
134
|
+
* @returns {number}
|
|
31
135
|
*/
|
|
32
|
-
|
|
136
|
+
receiver(): number;
|
|
33
137
|
/**
|
|
34
138
|
*/
|
|
35
|
-
|
|
139
|
+
build(): void;
|
|
36
140
|
}
|
|
37
141
|
|
|
38
142
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
39
143
|
|
|
40
144
|
export interface InitOutput {
|
|
145
|
+
readonly __wbg_bhtsne_free: (a: number) => void;
|
|
146
|
+
readonly bhtsne_new: (a: number) => number;
|
|
147
|
+
readonly bhtsne_step: (a: number, b: number, c: number) => void;
|
|
148
|
+
readonly bhtsne_learning_rate: (a: number, b: number) => void;
|
|
149
|
+
readonly bhtsne_epochs: (a: number, b: number) => void;
|
|
150
|
+
readonly bhtsne_momentum: (a: number, b: number) => void;
|
|
151
|
+
readonly bhtsne_final_momentum: (a: number, b: number) => void;
|
|
152
|
+
readonly bhtsne_momentum_switch_epoch: (a: number, b: number) => void;
|
|
153
|
+
readonly bhtsne_stop_lying_epoch: (a: number, b: number) => void;
|
|
154
|
+
readonly bhtsne_theta: (a: number, b: number) => void;
|
|
155
|
+
readonly bhtsne_embedding_dim: (a: number, b: number) => void;
|
|
156
|
+
readonly bhtsne_perplexity: (a: number, b: number) => void;
|
|
157
|
+
readonly __wbg_wbg_rayon_poolbuilder_free: (a: number) => void;
|
|
158
|
+
readonly wbg_rayon_poolbuilder_numThreads: (a: number) => number;
|
|
159
|
+
readonly wbg_rayon_poolbuilder_receiver: (a: number) => number;
|
|
160
|
+
readonly wbg_rayon_poolbuilder_build: (a: number) => void;
|
|
161
|
+
readonly initThreadPool: (a: number) => number;
|
|
162
|
+
readonly wbg_rayon_start_worker: (a: number) => void;
|
|
41
163
|
readonly memory: WebAssembly.Memory;
|
|
42
|
-
readonly __wbg_tsne_free: (a: number) => void;
|
|
43
|
-
readonly tsne_new: (a: number) => number;
|
|
44
|
-
readonly tsne_barnes_hut: (a: number, b: number) => number;
|
|
45
|
-
readonly tsne_set_theta: (a: number, b: number) => void;
|
|
46
164
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
47
165
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
48
|
-
readonly
|
|
166
|
+
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
49
167
|
readonly __wbindgen_exn_store: (a: number) => void;
|
|
168
|
+
readonly __wbindgen_thread_destroy: (a?: number, b?: number) => void;
|
|
169
|
+
readonly __wbindgen_start: () => void;
|
|
50
170
|
}
|
|
51
171
|
|
|
52
172
|
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
@@ -55,17 +175,19 @@ export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
|
55
175
|
* a precompiled `WebAssembly.Module`.
|
|
56
176
|
*
|
|
57
177
|
* @param {SyncInitInput} module
|
|
178
|
+
* @param {WebAssembly.Memory} maybe_memory
|
|
58
179
|
*
|
|
59
180
|
* @returns {InitOutput}
|
|
60
181
|
*/
|
|
61
|
-
export function initSync(module: SyncInitInput): InitOutput;
|
|
182
|
+
export function initSync(module: SyncInitInput, maybe_memory?: WebAssembly.Memory): InitOutput;
|
|
62
183
|
|
|
63
184
|
/**
|
|
64
185
|
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
65
186
|
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
66
187
|
*
|
|
67
188
|
* @param {InitInput | Promise<InitInput>} module_or_path
|
|
189
|
+
* @param {WebAssembly.Memory} maybe_memory
|
|
68
190
|
*
|
|
69
191
|
* @returns {Promise<InitOutput>}
|
|
70
192
|
*/
|
|
71
|
-
export default function __wbg_init (module_or_path?: InitInput | Promise<InitInput
|
|
193
|
+
export default function __wbg_init (module_or_path?: InitInput | Promise<InitInput>, maybe_memory?: WebAssembly.Memory): Promise<InitOutput>;
|
package/wasm_bhtsne.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { startWorkers } from './snippets/wasm-bindgen-rayon-3e04391371ad0a8e/src/workerHelpers.js';
|
|
2
|
+
|
|
1
3
|
let wasm;
|
|
2
4
|
|
|
3
5
|
const heap = new Array(128).fill(undefined);
|
|
@@ -27,7 +29,7 @@ function isLikeNone(x) {
|
|
|
27
29
|
let cachedFloat64Memory0 = null;
|
|
28
30
|
|
|
29
31
|
function getFloat64Memory0() {
|
|
30
|
-
if (cachedFloat64Memory0 === null || cachedFloat64Memory0.
|
|
32
|
+
if (cachedFloat64Memory0 === null || cachedFloat64Memory0.buffer !== wasm.memory.buffer) {
|
|
31
33
|
cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
|
|
32
34
|
}
|
|
33
35
|
return cachedFloat64Memory0;
|
|
@@ -36,37 +38,89 @@ function getFloat64Memory0() {
|
|
|
36
38
|
let cachedInt32Memory0 = null;
|
|
37
39
|
|
|
38
40
|
function getInt32Memory0() {
|
|
39
|
-
if (cachedInt32Memory0 === null || cachedInt32Memory0.
|
|
41
|
+
if (cachedInt32Memory0 === null || cachedInt32Memory0.buffer !== wasm.memory.buffer) {
|
|
40
42
|
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
|
41
43
|
}
|
|
42
44
|
return cachedInt32Memory0;
|
|
43
45
|
}
|
|
44
46
|
|
|
45
|
-
|
|
47
|
+
function addHeapObject(obj) {
|
|
48
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
49
|
+
const idx = heap_next;
|
|
50
|
+
heap_next = heap[idx];
|
|
46
51
|
|
|
47
|
-
|
|
52
|
+
heap[idx] = obj;
|
|
53
|
+
return idx;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
let WASM_VECTOR_LEN = 0;
|
|
48
57
|
|
|
49
58
|
let cachedUint8Memory0 = null;
|
|
50
59
|
|
|
51
60
|
function getUint8Memory0() {
|
|
52
|
-
if (cachedUint8Memory0 === null || cachedUint8Memory0.
|
|
61
|
+
if (cachedUint8Memory0 === null || cachedUint8Memory0.buffer !== wasm.memory.buffer) {
|
|
53
62
|
cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
|
|
54
63
|
}
|
|
55
64
|
return cachedUint8Memory0;
|
|
56
65
|
}
|
|
57
66
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
67
|
+
const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
|
|
68
|
+
|
|
69
|
+
const encodeString = function (arg, view) {
|
|
70
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
71
|
+
view.set(buf);
|
|
72
|
+
return {
|
|
73
|
+
read: arg.length,
|
|
74
|
+
written: buf.length
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
79
|
+
|
|
80
|
+
if (realloc === undefined) {
|
|
81
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
82
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
83
|
+
getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
84
|
+
WASM_VECTOR_LEN = buf.length;
|
|
85
|
+
return ptr;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
let len = arg.length;
|
|
89
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
90
|
+
|
|
91
|
+
const mem = getUint8Memory0();
|
|
92
|
+
|
|
93
|
+
let offset = 0;
|
|
94
|
+
|
|
95
|
+
for (; offset < len; offset++) {
|
|
96
|
+
const code = arg.charCodeAt(offset);
|
|
97
|
+
if (code > 0x7F) break;
|
|
98
|
+
mem[ptr + offset] = code;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (offset !== len) {
|
|
102
|
+
if (offset !== 0) {
|
|
103
|
+
arg = arg.slice(offset);
|
|
104
|
+
}
|
|
105
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
106
|
+
const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
|
|
107
|
+
const ret = encodeString(arg, view);
|
|
108
|
+
|
|
109
|
+
offset += ret.written;
|
|
110
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
WASM_VECTOR_LEN = offset;
|
|
114
|
+
return ptr;
|
|
61
115
|
}
|
|
62
116
|
|
|
63
|
-
|
|
64
|
-
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
65
|
-
const idx = heap_next;
|
|
66
|
-
heap_next = heap[idx];
|
|
117
|
+
const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
|
|
67
118
|
|
|
68
|
-
|
|
69
|
-
|
|
119
|
+
if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
|
|
120
|
+
|
|
121
|
+
function getStringFromWasm0(ptr, len) {
|
|
122
|
+
ptr = ptr >>> 0;
|
|
123
|
+
return cachedTextDecoder.decode(getUint8Memory0().slice(ptr, ptr + len));
|
|
70
124
|
}
|
|
71
125
|
|
|
72
126
|
function debugString(val) {
|
|
@@ -134,61 +188,6 @@ function debugString(val) {
|
|
|
134
188
|
return className;
|
|
135
189
|
}
|
|
136
190
|
|
|
137
|
-
let WASM_VECTOR_LEN = 0;
|
|
138
|
-
|
|
139
|
-
const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
|
|
140
|
-
|
|
141
|
-
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
|
|
142
|
-
? function (arg, view) {
|
|
143
|
-
return cachedTextEncoder.encodeInto(arg, view);
|
|
144
|
-
}
|
|
145
|
-
: function (arg, view) {
|
|
146
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
147
|
-
view.set(buf);
|
|
148
|
-
return {
|
|
149
|
-
read: arg.length,
|
|
150
|
-
written: buf.length
|
|
151
|
-
};
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
function passStringToWasm0(arg, malloc, realloc) {
|
|
155
|
-
|
|
156
|
-
if (realloc === undefined) {
|
|
157
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
158
|
-
const ptr = malloc(buf.length, 1) >>> 0;
|
|
159
|
-
getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
160
|
-
WASM_VECTOR_LEN = buf.length;
|
|
161
|
-
return ptr;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
let len = arg.length;
|
|
165
|
-
let ptr = malloc(len, 1) >>> 0;
|
|
166
|
-
|
|
167
|
-
const mem = getUint8Memory0();
|
|
168
|
-
|
|
169
|
-
let offset = 0;
|
|
170
|
-
|
|
171
|
-
for (; offset < len; offset++) {
|
|
172
|
-
const code = arg.charCodeAt(offset);
|
|
173
|
-
if (code > 0x7F) break;
|
|
174
|
-
mem[ptr + offset] = code;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
if (offset !== len) {
|
|
178
|
-
if (offset !== 0) {
|
|
179
|
-
arg = arg.slice(offset);
|
|
180
|
-
}
|
|
181
|
-
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
182
|
-
const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
|
|
183
|
-
const ret = encodeString(arg, view);
|
|
184
|
-
|
|
185
|
-
offset += ret.written;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
WASM_VECTOR_LEN = offset;
|
|
189
|
-
return ptr;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
191
|
function handleError(f, args) {
|
|
193
192
|
try {
|
|
194
193
|
return f.apply(this, args);
|
|
@@ -197,65 +196,229 @@ function handleError(f, args) {
|
|
|
197
196
|
}
|
|
198
197
|
}
|
|
199
198
|
/**
|
|
200
|
-
*
|
|
201
|
-
*
|
|
199
|
+
* @param {number} num_threads
|
|
200
|
+
* @returns {Promise<any>}
|
|
202
201
|
*/
|
|
203
|
-
export
|
|
202
|
+
export function initThreadPool(num_threads) {
|
|
203
|
+
const ret = wasm.initThreadPool(num_threads);
|
|
204
|
+
return takeObject(ret);
|
|
205
|
+
}
|
|
204
206
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
207
|
+
/**
|
|
208
|
+
* @param {number} receiver
|
|
209
|
+
*/
|
|
210
|
+
export function wbg_rayon_start_worker(receiver) {
|
|
211
|
+
wasm.wbg_rayon_start_worker(receiver);
|
|
212
|
+
}
|
|
209
213
|
|
|
210
|
-
|
|
211
|
-
}
|
|
214
|
+
const bhtSNEFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
215
|
+
? { register: () => {}, unregister: () => {} }
|
|
216
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_bhtsne_free(ptr >>> 0));
|
|
217
|
+
/**
|
|
218
|
+
* t-distributed stochastic neighbor embedding. Provides a parallel implementation of both the
|
|
219
|
+
* exact version of the algorithm and the tree accelerated one leveraging space partitioning trees.
|
|
220
|
+
*/
|
|
221
|
+
export class bhtSNE {
|
|
212
222
|
|
|
213
223
|
__destroy_into_raw() {
|
|
214
224
|
const ptr = this.__wbg_ptr;
|
|
215
225
|
this.__wbg_ptr = 0;
|
|
216
|
-
|
|
226
|
+
bhtSNEFinalization.unregister(this);
|
|
217
227
|
return ptr;
|
|
218
228
|
}
|
|
219
229
|
|
|
220
230
|
free() {
|
|
221
231
|
const ptr = this.__destroy_into_raw();
|
|
222
|
-
wasm.
|
|
232
|
+
wasm.__wbg_bhtsne_free(ptr);
|
|
223
233
|
}
|
|
224
234
|
/**
|
|
225
|
-
* @param {
|
|
235
|
+
* @param {any} data
|
|
226
236
|
*/
|
|
227
|
-
constructor(
|
|
228
|
-
const ret = wasm.
|
|
229
|
-
|
|
237
|
+
constructor(data) {
|
|
238
|
+
const ret = wasm.bhtsne_new(addHeapObject(data));
|
|
239
|
+
this.__wbg_ptr = ret >>> 0;
|
|
240
|
+
return this;
|
|
230
241
|
}
|
|
231
242
|
/**
|
|
232
243
|
* Performs a parallel Barnes-Hut approximation of the t-SNE algorithm.
|
|
233
244
|
*
|
|
234
245
|
* # Arguments
|
|
235
246
|
*
|
|
236
|
-
*
|
|
247
|
+
* `epochs` - Sets epochs, the maximum number of fitting iterations.
|
|
248
|
+
* @param {number} epochs
|
|
249
|
+
* @returns {any}
|
|
250
|
+
*/
|
|
251
|
+
step(epochs) {
|
|
252
|
+
try {
|
|
253
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
254
|
+
wasm.bhtsne_step(retptr, this.__wbg_ptr, epochs);
|
|
255
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
256
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
257
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
258
|
+
if (r2) {
|
|
259
|
+
throw takeObject(r1);
|
|
260
|
+
}
|
|
261
|
+
return takeObject(r0);
|
|
262
|
+
} finally {
|
|
263
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Sets a new learning rate.
|
|
268
|
+
*
|
|
269
|
+
* # Arguments
|
|
270
|
+
*
|
|
271
|
+
* `learning_rate` - new value for the learning rate.
|
|
272
|
+
* @param {number} learning_rate
|
|
273
|
+
*/
|
|
274
|
+
learning_rate(learning_rate) {
|
|
275
|
+
wasm.bhtsne_learning_rate(this.__wbg_ptr, learning_rate);
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Sets new epochs, i.e the maximum number of fitting iterations.
|
|
279
|
+
*
|
|
280
|
+
* # Arguments
|
|
281
|
+
*
|
|
282
|
+
* `epochs` - new value for the epochs.
|
|
283
|
+
* @param {number} epochs
|
|
284
|
+
*/
|
|
285
|
+
epochs(epochs) {
|
|
286
|
+
wasm.bhtsne_epochs(this.__wbg_ptr, epochs);
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Sets a new momentum.
|
|
290
|
+
*
|
|
291
|
+
* # Arguments
|
|
292
|
+
*
|
|
293
|
+
* `momentum` - new value for the momentum.
|
|
294
|
+
* @param {number} momentum
|
|
295
|
+
*/
|
|
296
|
+
momentum(momentum) {
|
|
297
|
+
wasm.bhtsne_momentum(this.__wbg_ptr, momentum);
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Sets a new final momentum.
|
|
301
|
+
*
|
|
302
|
+
* # Arguments
|
|
303
|
+
*
|
|
304
|
+
* `final_momentum` - new value for the final momentum.
|
|
305
|
+
* @param {number} final_momentum
|
|
306
|
+
*/
|
|
307
|
+
final_momentum(final_momentum) {
|
|
308
|
+
wasm.bhtsne_final_momentum(this.__wbg_ptr, final_momentum);
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Sets a new momentum switch epoch, i.e. the epoch after which the algorithm switches to
|
|
312
|
+
* `final_momentum` for the map update.
|
|
313
|
+
*
|
|
314
|
+
* # Arguments
|
|
315
|
+
*
|
|
316
|
+
* `momentum_switch_epoch` - new value for the momentum switch epoch.
|
|
317
|
+
* @param {number} momentum_switch_epoch
|
|
318
|
+
*/
|
|
319
|
+
momentum_switch_epoch(momentum_switch_epoch) {
|
|
320
|
+
wasm.bhtsne_momentum_switch_epoch(this.__wbg_ptr, momentum_switch_epoch);
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Sets a new stop lying epoch, i.e. the epoch after which the P distribution values become
|
|
324
|
+
* true, as defined in the original implementation. For epochs < `stop_lying_epoch` the values
|
|
325
|
+
* of the P distribution are multiplied by a factor equal to `12.0`.
|
|
326
|
+
*
|
|
327
|
+
* # Arguments
|
|
328
|
+
*
|
|
329
|
+
* `stop_lying_epoch` - new value for the stop lying epoch.
|
|
330
|
+
* @param {number} stop_lying_epoch
|
|
331
|
+
*/
|
|
332
|
+
stop_lying_epoch(stop_lying_epoch) {
|
|
333
|
+
wasm.bhtsne_stop_lying_epoch(this.__wbg_ptr, stop_lying_epoch);
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Sets a new theta, which determines the accuracy of the approximation. Must be **strictly greater than
|
|
237
337
|
* 0.0**. Large values for θ increase the speed of the algorithm but decrease its accuracy.
|
|
238
338
|
* For small values of θ it is less probable that a cell in the space partitioning tree will
|
|
239
339
|
* be treated as a single point. For θ equal to 0.0 the method degenerates in the exact
|
|
240
340
|
* version.
|
|
241
341
|
*
|
|
242
|
-
*
|
|
342
|
+
* # Arguments
|
|
243
343
|
*
|
|
344
|
+
* * `theta` - new value for the theta.
|
|
345
|
+
* @param {number} theta
|
|
346
|
+
*/
|
|
347
|
+
theta(theta) {
|
|
348
|
+
wasm.bhtsne_theta(this.__wbg_ptr, theta);
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* Sets a new value for the embedding dimension.
|
|
244
352
|
*
|
|
245
|
-
*
|
|
246
|
-
*
|
|
247
|
-
*
|
|
248
|
-
* @
|
|
353
|
+
* # Arguments
|
|
354
|
+
*
|
|
355
|
+
* `embedding_dim` - new value for the embedding space dimensionality.
|
|
356
|
+
* @param {number} embedding_dim
|
|
249
357
|
*/
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
return takeObject(ret);
|
|
358
|
+
embedding_dim(embedding_dim) {
|
|
359
|
+
wasm.bhtsne_embedding_dim(this.__wbg_ptr, embedding_dim);
|
|
253
360
|
}
|
|
254
361
|
/**
|
|
255
|
-
*
|
|
362
|
+
* Sets a new perplexity value.
|
|
363
|
+
*
|
|
364
|
+
* # Arguments
|
|
365
|
+
*
|
|
366
|
+
* `perplexity` - new value for the perplexity. It's used so that the bandwidth of the Gaussian
|
|
367
|
+
* kernels, is set in such a way that the perplexity of each the conditional distribution *Pi*
|
|
368
|
+
* equals a predefined perplexity *u*.
|
|
369
|
+
*
|
|
370
|
+
* A good value for perplexity lies between 5.0 and 50.0.
|
|
371
|
+
* @param {number} perplexity
|
|
372
|
+
*/
|
|
373
|
+
perplexity(perplexity) {
|
|
374
|
+
wasm.bhtsne_perplexity(this.__wbg_ptr, perplexity);
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
const wbg_rayon_PoolBuilderFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
379
|
+
? { register: () => {}, unregister: () => {} }
|
|
380
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wbg_rayon_poolbuilder_free(ptr >>> 0));
|
|
381
|
+
/**
|
|
382
|
+
*/
|
|
383
|
+
export class wbg_rayon_PoolBuilder {
|
|
384
|
+
|
|
385
|
+
static __wrap(ptr) {
|
|
386
|
+
ptr = ptr >>> 0;
|
|
387
|
+
const obj = Object.create(wbg_rayon_PoolBuilder.prototype);
|
|
388
|
+
obj.__wbg_ptr = ptr;
|
|
389
|
+
wbg_rayon_PoolBuilderFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
390
|
+
return obj;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
__destroy_into_raw() {
|
|
394
|
+
const ptr = this.__wbg_ptr;
|
|
395
|
+
this.__wbg_ptr = 0;
|
|
396
|
+
wbg_rayon_PoolBuilderFinalization.unregister(this);
|
|
397
|
+
return ptr;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
free() {
|
|
401
|
+
const ptr = this.__destroy_into_raw();
|
|
402
|
+
wasm.__wbg_wbg_rayon_poolbuilder_free(ptr);
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* @returns {number}
|
|
256
406
|
*/
|
|
257
|
-
|
|
258
|
-
wasm.
|
|
407
|
+
numThreads() {
|
|
408
|
+
const ret = wasm.wbg_rayon_poolbuilder_numThreads(this.__wbg_ptr);
|
|
409
|
+
return ret >>> 0;
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* @returns {number}
|
|
413
|
+
*/
|
|
414
|
+
receiver() {
|
|
415
|
+
const ret = wasm.wbg_rayon_poolbuilder_receiver(this.__wbg_ptr);
|
|
416
|
+
return ret >>> 0;
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
*/
|
|
420
|
+
build() {
|
|
421
|
+
wasm.wbg_rayon_poolbuilder_build(this.__wbg_ptr);
|
|
259
422
|
}
|
|
260
423
|
}
|
|
261
424
|
|
|
@@ -302,52 +465,57 @@ function __wbg_get_imports() {
|
|
|
302
465
|
getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
|
|
303
466
|
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
|
|
304
467
|
};
|
|
305
|
-
imports.wbg.
|
|
306
|
-
const ret =
|
|
468
|
+
imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
|
|
469
|
+
const ret = getObject(arg0);
|
|
307
470
|
return addHeapObject(ret);
|
|
308
471
|
};
|
|
309
|
-
imports.wbg.
|
|
310
|
-
const
|
|
311
|
-
const
|
|
312
|
-
|
|
472
|
+
imports.wbg.__wbindgen_is_object = function(arg0) {
|
|
473
|
+
const val = getObject(arg0);
|
|
474
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
475
|
+
return ret;
|
|
476
|
+
};
|
|
477
|
+
imports.wbg.__wbindgen_jsval_loose_eq = function(arg0, arg1) {
|
|
478
|
+
const ret = getObject(arg0) == getObject(arg1);
|
|
479
|
+
return ret;
|
|
480
|
+
};
|
|
481
|
+
imports.wbg.__wbindgen_boolean_get = function(arg0) {
|
|
482
|
+
const v = getObject(arg0);
|
|
483
|
+
const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
|
|
484
|
+
return ret;
|
|
485
|
+
};
|
|
486
|
+
imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
|
|
487
|
+
const obj = getObject(arg1);
|
|
488
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
489
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
490
|
+
var len1 = WASM_VECTOR_LEN;
|
|
313
491
|
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
314
492
|
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
315
493
|
};
|
|
316
|
-
imports.wbg.
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
try {
|
|
320
|
-
deferred0_0 = arg0;
|
|
321
|
-
deferred0_1 = arg1;
|
|
322
|
-
console.error(getStringFromWasm0(arg0, arg1));
|
|
323
|
-
} finally {
|
|
324
|
-
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
325
|
-
}
|
|
494
|
+
imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
|
|
495
|
+
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
496
|
+
return addHeapObject(ret);
|
|
326
497
|
};
|
|
327
|
-
imports.wbg.
|
|
328
|
-
|
|
329
|
-
}, arguments) };
|
|
330
|
-
imports.wbg.__wbg_getRandomValues_37fa2ca9e4e07fab = function() { return handleError(function (arg0, arg1) {
|
|
331
|
-
getObject(arg0).getRandomValues(getObject(arg1));
|
|
332
|
-
}, arguments) };
|
|
333
|
-
imports.wbg.__wbg_crypto_c48a774b022d20ac = function(arg0) {
|
|
334
|
-
const ret = getObject(arg0).crypto;
|
|
498
|
+
imports.wbg.__wbindgen_number_new = function(arg0) {
|
|
499
|
+
const ret = arg0;
|
|
335
500
|
return addHeapObject(ret);
|
|
336
501
|
};
|
|
337
|
-
imports.wbg.
|
|
338
|
-
const
|
|
339
|
-
|
|
340
|
-
return ret;
|
|
502
|
+
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
|
|
503
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
504
|
+
return addHeapObject(ret);
|
|
341
505
|
};
|
|
342
|
-
imports.wbg.
|
|
506
|
+
imports.wbg.__wbg_crypto_1d1f22824a6a080c = function(arg0) {
|
|
507
|
+
const ret = getObject(arg0).crypto;
|
|
508
|
+
return addHeapObject(ret);
|
|
509
|
+
};
|
|
510
|
+
imports.wbg.__wbg_process_4a72847cc503995b = function(arg0) {
|
|
343
511
|
const ret = getObject(arg0).process;
|
|
344
512
|
return addHeapObject(ret);
|
|
345
513
|
};
|
|
346
|
-
imports.wbg.
|
|
514
|
+
imports.wbg.__wbg_versions_f686565e586dd935 = function(arg0) {
|
|
347
515
|
const ret = getObject(arg0).versions;
|
|
348
516
|
return addHeapObject(ret);
|
|
349
517
|
};
|
|
350
|
-
imports.wbg.
|
|
518
|
+
imports.wbg.__wbg_node_104a2ff8d6ea03a2 = function(arg0) {
|
|
351
519
|
const ret = getObject(arg0).node;
|
|
352
520
|
return addHeapObject(ret);
|
|
353
521
|
};
|
|
@@ -355,27 +523,39 @@ function __wbg_get_imports() {
|
|
|
355
523
|
const ret = typeof(getObject(arg0)) === 'string';
|
|
356
524
|
return ret;
|
|
357
525
|
};
|
|
358
|
-
imports.wbg.
|
|
526
|
+
imports.wbg.__wbg_require_cca90b1a94a0255b = function() { return handleError(function () {
|
|
359
527
|
const ret = module.require;
|
|
360
528
|
return addHeapObject(ret);
|
|
361
529
|
}, arguments) };
|
|
362
|
-
imports.wbg.
|
|
363
|
-
const ret = getStringFromWasm0(arg0, arg1);
|
|
364
|
-
return addHeapObject(ret);
|
|
365
|
-
};
|
|
366
|
-
imports.wbg.__wbg_msCrypto_bcb970640f50a1e8 = function(arg0) {
|
|
530
|
+
imports.wbg.__wbg_msCrypto_eb05e62b530a1508 = function(arg0) {
|
|
367
531
|
const ret = getObject(arg0).msCrypto;
|
|
368
532
|
return addHeapObject(ret);
|
|
369
533
|
};
|
|
370
|
-
imports.wbg.
|
|
534
|
+
imports.wbg.__wbg_randomFillSync_5c9c955aa56b6049 = function() { return handleError(function (arg0, arg1) {
|
|
535
|
+
getObject(arg0).randomFillSync(takeObject(arg1));
|
|
536
|
+
}, arguments) };
|
|
537
|
+
imports.wbg.__wbg_getRandomValues_3aa56aa6edec874c = function() { return handleError(function (arg0, arg1) {
|
|
538
|
+
getObject(arg0).getRandomValues(getObject(arg1));
|
|
539
|
+
}, arguments) };
|
|
540
|
+
imports.wbg.__wbg_instanceof_Window_f401953a2cf86220 = function(arg0) {
|
|
541
|
+
let result;
|
|
542
|
+
try {
|
|
543
|
+
result = getObject(arg0) instanceof Window;
|
|
544
|
+
} catch (_) {
|
|
545
|
+
result = false;
|
|
546
|
+
}
|
|
547
|
+
const ret = result;
|
|
548
|
+
return ret;
|
|
549
|
+
};
|
|
550
|
+
imports.wbg.__wbg_get_bd8e338fbd5f5cc8 = function(arg0, arg1) {
|
|
371
551
|
const ret = getObject(arg0)[arg1 >>> 0];
|
|
372
552
|
return addHeapObject(ret);
|
|
373
553
|
};
|
|
374
|
-
imports.wbg.
|
|
554
|
+
imports.wbg.__wbg_length_cd7af8117672b8b8 = function(arg0) {
|
|
375
555
|
const ret = getObject(arg0).length;
|
|
376
556
|
return ret;
|
|
377
557
|
};
|
|
378
|
-
imports.wbg.
|
|
558
|
+
imports.wbg.__wbg_new_16b304a2cfa7ff4a = function() {
|
|
379
559
|
const ret = new Array();
|
|
380
560
|
return addHeapObject(ret);
|
|
381
561
|
};
|
|
@@ -383,27 +563,51 @@ function __wbg_get_imports() {
|
|
|
383
563
|
const ret = typeof(getObject(arg0)) === 'function';
|
|
384
564
|
return ret;
|
|
385
565
|
};
|
|
386
|
-
imports.wbg.
|
|
566
|
+
imports.wbg.__wbg_newnoargs_e258087cd0daa0ea = function(arg0, arg1) {
|
|
387
567
|
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
|
388
568
|
return addHeapObject(ret);
|
|
389
569
|
};
|
|
390
|
-
imports.wbg.
|
|
570
|
+
imports.wbg.__wbg_next_40fc327bfc8770e6 = function(arg0) {
|
|
571
|
+
const ret = getObject(arg0).next;
|
|
572
|
+
return addHeapObject(ret);
|
|
573
|
+
};
|
|
574
|
+
imports.wbg.__wbg_next_196c84450b364254 = function() { return handleError(function (arg0) {
|
|
575
|
+
const ret = getObject(arg0).next();
|
|
576
|
+
return addHeapObject(ret);
|
|
577
|
+
}, arguments) };
|
|
578
|
+
imports.wbg.__wbg_done_298b57d23c0fc80c = function(arg0) {
|
|
579
|
+
const ret = getObject(arg0).done;
|
|
580
|
+
return ret;
|
|
581
|
+
};
|
|
582
|
+
imports.wbg.__wbg_value_d93c65011f51a456 = function(arg0) {
|
|
583
|
+
const ret = getObject(arg0).value;
|
|
584
|
+
return addHeapObject(ret);
|
|
585
|
+
};
|
|
586
|
+
imports.wbg.__wbg_iterator_2cee6dadfd956dfa = function() {
|
|
587
|
+
const ret = Symbol.iterator;
|
|
588
|
+
return addHeapObject(ret);
|
|
589
|
+
};
|
|
590
|
+
imports.wbg.__wbg_get_e3c254076557e348 = function() { return handleError(function (arg0, arg1) {
|
|
591
|
+
const ret = Reflect.get(getObject(arg0), getObject(arg1));
|
|
592
|
+
return addHeapObject(ret);
|
|
593
|
+
}, arguments) };
|
|
594
|
+
imports.wbg.__wbg_call_27c0f87801dedf93 = function() { return handleError(function (arg0, arg1) {
|
|
391
595
|
const ret = getObject(arg0).call(getObject(arg1));
|
|
392
596
|
return addHeapObject(ret);
|
|
393
597
|
}, arguments) };
|
|
394
|
-
imports.wbg.
|
|
598
|
+
imports.wbg.__wbg_self_ce0dbfc45cf2f5be = function() { return handleError(function () {
|
|
395
599
|
const ret = self.self;
|
|
396
600
|
return addHeapObject(ret);
|
|
397
601
|
}, arguments) };
|
|
398
|
-
imports.wbg.
|
|
602
|
+
imports.wbg.__wbg_window_c6fb939a7f436783 = function() { return handleError(function () {
|
|
399
603
|
const ret = window.window;
|
|
400
604
|
return addHeapObject(ret);
|
|
401
605
|
}, arguments) };
|
|
402
|
-
imports.wbg.
|
|
606
|
+
imports.wbg.__wbg_globalThis_d1e6af4856ba331b = function() { return handleError(function () {
|
|
403
607
|
const ret = globalThis.globalThis;
|
|
404
608
|
return addHeapObject(ret);
|
|
405
609
|
}, arguments) };
|
|
406
|
-
imports.wbg.
|
|
610
|
+
imports.wbg.__wbg_global_207b558942527489 = function() { return handleError(function () {
|
|
407
611
|
const ret = global.global;
|
|
408
612
|
return addHeapObject(ret);
|
|
409
613
|
}, arguments) };
|
|
@@ -411,53 +615,64 @@ function __wbg_get_imports() {
|
|
|
411
615
|
const ret = getObject(arg0) === undefined;
|
|
412
616
|
return ret;
|
|
413
617
|
};
|
|
414
|
-
imports.wbg.
|
|
618
|
+
imports.wbg.__wbg_set_d4638f722068f043 = function(arg0, arg1, arg2) {
|
|
619
|
+
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
|
620
|
+
};
|
|
621
|
+
imports.wbg.__wbg_isArray_2ab64d95e09ea0ae = function(arg0) {
|
|
415
622
|
const ret = Array.isArray(getObject(arg0));
|
|
416
623
|
return ret;
|
|
417
624
|
};
|
|
418
|
-
imports.wbg.
|
|
419
|
-
|
|
625
|
+
imports.wbg.__wbg_instanceof_ArrayBuffer_836825be07d4c9d2 = function(arg0) {
|
|
626
|
+
let result;
|
|
627
|
+
try {
|
|
628
|
+
result = getObject(arg0) instanceof ArrayBuffer;
|
|
629
|
+
} catch (_) {
|
|
630
|
+
result = false;
|
|
631
|
+
}
|
|
632
|
+
const ret = result;
|
|
420
633
|
return ret;
|
|
421
634
|
};
|
|
422
|
-
imports.wbg.
|
|
635
|
+
imports.wbg.__wbg_call_b3ca7c6051f9bec1 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
423
636
|
const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
|
|
424
637
|
return addHeapObject(ret);
|
|
425
638
|
}, arguments) };
|
|
426
|
-
imports.wbg.
|
|
639
|
+
imports.wbg.__wbg_buffer_12d079cc21e14bdb = function(arg0) {
|
|
427
640
|
const ret = getObject(arg0).buffer;
|
|
428
641
|
return addHeapObject(ret);
|
|
429
642
|
};
|
|
430
|
-
imports.wbg.
|
|
643
|
+
imports.wbg.__wbg_newwithbyteoffsetandlength_aa4a17c33a06e5cb = function(arg0, arg1, arg2) {
|
|
431
644
|
const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
|
|
432
645
|
return addHeapObject(ret);
|
|
433
646
|
};
|
|
434
|
-
imports.wbg.
|
|
647
|
+
imports.wbg.__wbg_new_63b92bc8671ed464 = function(arg0) {
|
|
435
648
|
const ret = new Uint8Array(getObject(arg0));
|
|
436
649
|
return addHeapObject(ret);
|
|
437
650
|
};
|
|
438
|
-
imports.wbg.
|
|
651
|
+
imports.wbg.__wbg_set_a47bac70306a19a7 = function(arg0, arg1, arg2) {
|
|
439
652
|
getObject(arg0).set(getObject(arg1), arg2 >>> 0);
|
|
440
653
|
};
|
|
441
|
-
imports.wbg.
|
|
442
|
-
const ret =
|
|
443
|
-
return
|
|
654
|
+
imports.wbg.__wbg_length_c20a40f15020d68a = function(arg0) {
|
|
655
|
+
const ret = getObject(arg0).length;
|
|
656
|
+
return ret;
|
|
444
657
|
};
|
|
445
|
-
imports.wbg.
|
|
446
|
-
|
|
447
|
-
|
|
658
|
+
imports.wbg.__wbg_instanceof_Uint8Array_2b3bbecd033d19f6 = function(arg0) {
|
|
659
|
+
let result;
|
|
660
|
+
try {
|
|
661
|
+
result = getObject(arg0) instanceof Uint8Array;
|
|
662
|
+
} catch (_) {
|
|
663
|
+
result = false;
|
|
664
|
+
}
|
|
665
|
+
const ret = result;
|
|
666
|
+
return ret;
|
|
448
667
|
};
|
|
449
|
-
imports.wbg.
|
|
668
|
+
imports.wbg.__wbg_newwithlength_e9b4878cebadb3d3 = function(arg0) {
|
|
450
669
|
const ret = new Uint8Array(arg0 >>> 0);
|
|
451
670
|
return addHeapObject(ret);
|
|
452
671
|
};
|
|
453
|
-
imports.wbg.
|
|
672
|
+
imports.wbg.__wbg_subarray_a1f73cd4b5b42fe1 = function(arg0, arg1, arg2) {
|
|
454
673
|
const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
|
|
455
674
|
return addHeapObject(ret);
|
|
456
675
|
};
|
|
457
|
-
imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
|
|
458
|
-
const ret = getObject(arg0);
|
|
459
|
-
return addHeapObject(ret);
|
|
460
|
-
};
|
|
461
676
|
imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
|
|
462
677
|
const ret = debugString(getObject(arg1));
|
|
463
678
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
@@ -468,16 +683,24 @@ function __wbg_get_imports() {
|
|
|
468
683
|
imports.wbg.__wbindgen_throw = function(arg0, arg1) {
|
|
469
684
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
470
685
|
};
|
|
686
|
+
imports.wbg.__wbindgen_module = function() {
|
|
687
|
+
const ret = __wbg_init.__wbindgen_wasm_module;
|
|
688
|
+
return addHeapObject(ret);
|
|
689
|
+
};
|
|
471
690
|
imports.wbg.__wbindgen_memory = function() {
|
|
472
691
|
const ret = wasm.memory;
|
|
473
692
|
return addHeapObject(ret);
|
|
474
693
|
};
|
|
694
|
+
imports.wbg.__wbg_startWorkers_2ee336a9694dda13 = function(arg0, arg1, arg2) {
|
|
695
|
+
const ret = startWorkers(takeObject(arg0), takeObject(arg1), wbg_rayon_PoolBuilder.__wrap(arg2));
|
|
696
|
+
return addHeapObject(ret);
|
|
697
|
+
};
|
|
475
698
|
|
|
476
699
|
return imports;
|
|
477
700
|
}
|
|
478
701
|
|
|
479
702
|
function __wbg_init_memory(imports, maybe_memory) {
|
|
480
|
-
|
|
703
|
+
imports.wbg.memory = maybe_memory || new WebAssembly.Memory({initial:18,maximum:16384,shared:true});
|
|
481
704
|
}
|
|
482
705
|
|
|
483
706
|
function __wbg_finalize_init(instance, module) {
|
|
@@ -487,16 +710,16 @@ function __wbg_finalize_init(instance, module) {
|
|
|
487
710
|
cachedInt32Memory0 = null;
|
|
488
711
|
cachedUint8Memory0 = null;
|
|
489
712
|
|
|
490
|
-
|
|
713
|
+
wasm.__wbindgen_start();
|
|
491
714
|
return wasm;
|
|
492
715
|
}
|
|
493
716
|
|
|
494
|
-
function initSync(module) {
|
|
717
|
+
function initSync(module, maybe_memory) {
|
|
495
718
|
if (wasm !== undefined) return wasm;
|
|
496
719
|
|
|
497
720
|
const imports = __wbg_get_imports();
|
|
498
721
|
|
|
499
|
-
__wbg_init_memory(imports);
|
|
722
|
+
__wbg_init_memory(imports, maybe_memory);
|
|
500
723
|
|
|
501
724
|
if (!(module instanceof WebAssembly.Module)) {
|
|
502
725
|
module = new WebAssembly.Module(module);
|
|
@@ -507,7 +730,7 @@ function initSync(module) {
|
|
|
507
730
|
return __wbg_finalize_init(instance, module);
|
|
508
731
|
}
|
|
509
732
|
|
|
510
|
-
async function __wbg_init(input) {
|
|
733
|
+
async function __wbg_init(input, maybe_memory) {
|
|
511
734
|
if (wasm !== undefined) return wasm;
|
|
512
735
|
|
|
513
736
|
if (typeof input === 'undefined') {
|
|
@@ -519,7 +742,7 @@ async function __wbg_init(input) {
|
|
|
519
742
|
input = fetch(input);
|
|
520
743
|
}
|
|
521
744
|
|
|
522
|
-
__wbg_init_memory(imports);
|
|
745
|
+
__wbg_init_memory(imports, maybe_memory);
|
|
523
746
|
|
|
524
747
|
const { instance, module } = await __wbg_load(await input, imports);
|
|
525
748
|
|
package/wasm_bhtsne_bg.wasm
CHANGED
|
Binary file
|