Skip to content
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

sync vs async #17

Open
ralphtheninja opened this issue Jan 5, 2018 · 3 comments
Open

sync vs async #17

ralphtheninja opened this issue Jan 5, 2018 · 3 comments

Comments

@ralphtheninja
Copy link
Contributor

ralphtheninja commented Jan 5, 2018

So the session.run() operation is synchronous. If this can take a lot of time it doesn't really play nice with the node way of doing things.

// Run to evaluate and retrieve the value of the 'result' op.
let outputs = session.run(/* inputs */ null,
                          /* outputs */ [ 'result' ],
                          /* targets */ null);

// Should print out '42'
console.log(outputs.result.toValue());

Is it possible to make operations like this async using node-ffi?

@ralphtheninja
Copy link
Contributor Author

ralphtheninja commented Jan 5, 2018

Ideally session.run() should take a callback as last argument or it could return a Promise which resolves to result.

@nikhilk
Copy link
Owner

nikhilk commented Jan 5, 2018

Agree; need to see if we can make this work with ffi, and add a runAsync that returns a Promise.

If we can't with just ffi it may be an interesting feature request for the TensorFlow C API.

@nikhilk
Copy link
Owner

nikhilk commented Jan 5, 2018

This seems simpler than I thought it might have been with what ffi supports -- for reference: https://github.com/node-ffi/node-ffi/wiki/Node-FFI-Tutorial#async-library-calls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants