Repository: mil-tokyo/webdnn (language: python)

Issue:
Yarn build failed and WebDNN load issue
Hi,
While running **yarn build:all** following errors are encountered:

```
ERROR in webdnn/src/descriptor_runner/operators/wasm/worker/worker.ts
./src/descriptor_runner/operators/wasm/worker/worker.ts 2:61813-61819
[tsl] ERROR in /Users/sidharth/Documents/Projects/webdnn/src/descriptor_runner/operators/wasm/worker/worker.ts(2,61814)
      TS2304: Cannot find name 'reason'.
 @ ./src/descriptor_runner/index.ts 34:17-58

ERROR in webdnn/src/descriptor_runner/operators/wasm/worker/worker.ts
./src/descriptor_runner/operators/wasm/worker/worker.ts 2:62278-62284
[tsl] ERROR in /Users/sidharth/Documents/Projects/webdnn/src/descriptor_runner/operators/wasm/worker/worker.ts(2,62279)
      TS2304: Cannot find name 'reason'.
 @ ./src/descriptor_runner/index.ts 34:17-58

ERROR in webdnn/src/descriptor_runner/operators/wasm/worker/worker.ts
./src/descriptor_runner/operators/wasm/worker/worker.ts 2:63036-63037
[tsl] ERROR in /Users/sidharth/Documents/Projects/webdnn/src/descriptor_runner/operators/wasm/worker/worker.ts(2,63037)
      TS2304: Cannot find name 'e'.
 @ ./src/descriptor_runner/index.ts 34:17-58

ERROR in webdnn/src/descriptor_runner/operators/wasm/worker/worker.ts
./src/descriptor_runner/operators/wasm/worker/worker.ts 2:64421-64433
[tsl] ERROR in /Users/sidharth/Documents/Projects/webdnn/src/descriptor_runner/operators/wasm/worker/worker.ts(2,64422)
      TS2304: Cannot find name 'UTF8ToString'.
 @ ./src/descriptor_runner/index.ts 34:17-58

ERROR in webdnn/src/descriptor_runner/operators/wasm/worker/worker.ts
./src/descriptor_runner/operators/wasm/worker/worker.ts 2:64434-64443
[tsl] ERROR in /Users/sidharth/Documents/Projects/webdnn/src/descriptor_runner/operators/wasm/worker/worker.ts(2,64435)
      TS2304: Cannot find name 'condition'.
 @ ./src/descriptor_runner/index.ts 34:17-58

webpack 5.37.0 compiled with 5 errors in 1919 ms
```

On running https://github.com/mil-tokyo/webdnn/tree/master/example/minimum WebDNN is undefined in https://github.com/mil-tokyo/webdnn/blob/master/example/minimum/index.html#L11


`Ran with **Node Version: v19.9.0** and **v18.20.5**
`

tsconfig.json
```
{
  "compilerOptions": {
    "target": "esnext",
    "module": "commonjs",
    "strict": true,
    "skipLibCheck": true,
    "declaration": true,
    "pretty": true,
    "esModuleInterop": true,
    "newLine": "lf",
    "outDir": "dist",
    "lib": [
      "es2019",
      "dom"
    ],
    "typeRoots": ["./node_modules/@webgpu/types", "./node_modules/@types"]
  },
  "include": [
    "src/descriptor_runner"
  ]
}

```

Thanks!


Discussion / hints:

Fix patch:
diff --git a/README.ja.md b/README.ja.md
index 5e92fe0b..be81b36f 100644
--- a/README.ja.md
+++ b/README.ja.md
@@ -57,6 +57,7 @@ console.log(outputTensor.data);  // Float32Array
 テスト対象のONNXモデルおよび、入出力テンソルの生成
 
 ```
+pip install -r requirements.test.txt
 python test/model_test/make_models.py
 ```
 
diff --git a/README.md b/README.md
index ce040ebe..ce4a1ca3 100644
--- a/README.md
+++ b/README.md
@@ -57,6 +57,7 @@ See `example/minimum` for the complete minimal code that works.
 Generate ONNX models and input/output tensors to be tested
 
 ```
+pip install -r requirements.test.txt
 python test/model_test/make_models.py
 ```
 
diff --git a/src/shader/wasm/compile.py b/src/shader/wasm/compile.py
index 1ddface1..b4c3a8bf 100644
--- a/src/shader/wasm/compile.py
+++ b/src/shader/wasm/compile.py
@@ -37,7 +37,7 @@
     worker_js = f.read()
 
 worker_js_with_wasm = worker_js.replace("WASM_WORKER_WASM_BINARY_BASE64", base64.b64encode(worker_wasm).decode("ascii"))
-worker_js_with_wasm_escaped = worker_js_with_wasm.replace("\\", "\\\\").replace("`", "\\`")
+worker_js_with_wasm_escaped = worker_js_with_wasm.replace("\\", "\\\\").replace("`", "\\`").replace("$", "\\$")
 
 worker_data_url_src = f"""/* eslint-disable */
 export const wasmWorkerSrcUrl = URL.createObjectURL(new File([`{worker_js_with_wasm_escaped}`], "worker.js", {{type: "text/javascript"}}));


Test patch:
diff --git a/requirements.test.txt b/requirements.test.txt
new file mode 100644
index 00000000..538051c0
--- /dev/null
+++ b/requirements.test.txt
@@ -0,0 +1,4 @@
+onnx
+onnxruntime
+torch
+torchvision