-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support sync API and require pre-allocated output buffers #174
Conversation
Leave MLInput only for dynamic input shape.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @huningxin! I submitted some review comments.
I'd encourage @wchao1115 @pyu10055 @RafaelCintron to take an in-depth look at this PR latest before our next call.
@pyu10055 @RafaelCintron we appreciate your quick review of this PR before this Thursday's call. |
@@ -102,7 +103,7 @@ export class NSNet2 { | |||
this.hiddenSize = 400; | |||
} | |||
|
|||
async load(baseUrl, batchSize, frames) { | |||
async build(baseUrl, batchSize, frames) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you need to remove async keyword if build method is sync.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is needed, because buildConstantByNpy
in this function uses fetch
to download .npy
files from network which is async.
Thanks for the review and approval. I am going to merge this PR. |
This PR follows the discussion in PR #166 and fixes use case #156. The changes include
MLGraphBuilder.build
andMLGraph.compute
to sync API.a. Sync API is easy to use and required by sync wasm lib implementation.
b. The caller can call the sync API within a webworker to achieve asynchronous Support CPU - WebAssembly scenario of the op level execution use case #156 (comment) @pyu10055
MLGraph.compute
to require pre-allocated output buffers.a. For wasm lib, the output buffers are pre-allcoated in wasm memory.
b. For GPU, it is prohibitively expensive to create GPU resources on the fly as a function call's return value Support download data asynchronously #166 (comment) @wchao1115
MLResource
. LeaveMLInput
only for dynamic input shape case.Please take a look. Thanks.
Preview | Diff