Skip to content

Commit

Permalink
Hide the mx.evalInWorker API for now
Browse files Browse the repository at this point in the history
  • Loading branch information
zcbenz committed Oct 1, 2024
1 parent 7c94428 commit 7f1ee93
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,23 +116,6 @@ copying.
const buffer: Uint8Array = mx.array([1, 2, 3, 4], mx.uint8);
```

#### `mx.evalInWorker`

The `mx.eval` API is synchronous that the main thread would be blocked waiting
for the result, which breaks the assumption of Node.js that nothing should block
in main thread, and results in a hanging process that not responding to
anything, including tries to end the process with Ctrl+C.

The JavaScript-only `mx.evalInWorker` API runs `mx.eval` in a worker thread and
returns a promise that resolves when the call ends. It is useful when the
program runs a large model and you want to make the app alive to user
interactions while doing computations.

```typescript
const y = model.forward(x);
await mx.evalInWorker(y);
```

#### `mx.tidy`

This is the same with [`tf.tidy`](https://js.tensorflow.org/api/latest/#tidy)
Expand Down

0 comments on commit 7f1ee93

Please sign in to comment.