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 pull request adds a TensorFlow library to Pyret for the development of programs with machine learning capabilities. It's a transfer of the code from this pyret-lang branch to CPO.
The library code is located at src/js/trove/tensorflow.js and (mostly complete) documentation is located in a separate pull request at brownplt/pyret-docs#44. The old branch contains example programs at examples/tensorflow, but I'll extract those out to a separate repo in the meantime.
Most of the functions in the Pyret library are ported from the existing TensorFlow.js project. Two important questions:
num_to_roughnum
function in the Pyret runtime at this pull request: Expose num_to_roughnum from runtime pyret-lang#1393. There might be a better way to do this—let me know!And a few interesting notes:
Float32Arrays
. As such, retrieving data from a Pyret Tensor always returns aList<Roughnum>
. Unavoidably, this also means that all Pyret numbers need to be converted to JavaScript fixnums before passing them to a TensorFlow.js function, so we’ll lose some precision and won’t be able to handle arbitrary large numbers. However, this should be fine, since this is a limitation of the official TensorFlow.js library too.