You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* A workaround to define a new backend for onnxruntime, which
13
12
* will not throw an error when running tests with jest.
14
13
* For more information, see: https://github.com/jestjs/jest/issues/11864#issuecomment-1261468011
15
14
*/
16
15
exportfunctioninit(){
17
-
// In rare cases (specifically when running unit tests with GitHub actions), possibly due to
18
-
// a large number of concurrent executions, onnxruntime might fallback to use the WASM backend.
19
-
// In this case, we set the number of threads to 1 to avoid errors like:
20
-
// - `TypeError: The worker script or module filename must be an absolute path or a relative path starting with './' or '../'. Received "blob:nodedata:..."`
21
-
ONNX_COMMON.env.wasm.numThreads=1;
22
-
23
-
letregisterBackend=ONNX_COMMON.registerBackend;
24
-
25
-
// Define the constructors to monkey-patch
26
-
constTYPED_ARRAYS_CONSTRUCTOR_NAMES=[
27
-
"Int8Array",
28
-
"Int16Array",
29
-
"Int32Array",
30
-
"BigInt64Array",
31
-
"Uint8Array",
32
-
"Uint8ClampedArray",
33
-
"Uint16Array",
34
-
"Uint32Array",
35
-
"BigUint64Array",
36
-
"Float32Array",
37
-
"Float64Array",
38
-
];
39
-
40
-
// Keep a reference to the original initialization method
// In rare cases (specifically when running unit tests with GitHub actions), possibly due to
17
+
// a large number of concurrent executions, onnxruntime might fallback to use the WASM backend.
18
+
// In this case, we set the number of threads to 1 to avoid errors like:
19
+
// - `TypeError: The worker script or module filename must be an absolute path or a relative path starting with './' or '../'. Received "blob:nodedata:..."`
0 commit comments