Support sync API and require pre-allocated output buffers#174
Merged
huningxin merged 4 commits intowebmachinelearning:mainfrom Jun 10, 2021
Merged
Support sync API and require pre-allocated output buffers#174huningxin merged 4 commits intowebmachinelearning:mainfrom
huningxin merged 4 commits intowebmachinelearning:mainfrom
Conversation
Leave MLInput only for dynamic input shape.
anssiko
requested changes
Jun 3, 2021
Member
anssiko
left a comment
There was a problem hiding this comment.
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.
wchao1115
requested changes
Jun 5, 2021
wchao1115
approved these changes
Jun 7, 2021
anssiko
approved these changes
Jun 7, 2021
Member
|
@pyu10055 @RafaelCintron we appreciate your quick review of this PR before this Thursday's call. |
pyu10055
approved these changes
Jun 7, 2021
| } | ||
|
|
||
| async load(baseUrl, batchSize, frames) { | ||
| async build(baseUrl, batchSize, frames) { |
Collaborator
There was a problem hiding this comment.
you need to remove async keyword if build method is sync.
Contributor
Author
There was a problem hiding this comment.
This is needed, because buildConstantByNpy in this function uses fetch to download .npy files from network which is async.
Contributor
Author
|
Thanks for the review and approval. I am going to merge this PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR follows the discussion in PR #166 and fixes use case #156. The changes include
MLGraphBuilder.buildandMLGraph.computeto 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.computeto 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. LeaveMLInputonly for dynamic input shape case.Please take a look. Thanks.
Preview | Diff