1.1.0 • Published 6 years ago

babel-plugin-tensorflow v1.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

Prototype Babel Plugin TensorFlow

Use native javascript math operators on TensorFlow objects.

Turns

tf(A * w + b);

into

tf.add(tf.mul(A, w), b);

And also

tf(5 * [1, 2] + [2, 2]);

into

tf.add(tf.mul(tf.scalar(5), tf.tensor([1, 2])), tf.tensor([2, 2]));

More examples

Install

With npm

npm install --save-dev babel-plugin-tensorflow

With yarn

yarn add --dev babel-plugin-tensorflow

And add the plugin to your .babelrc file

{
  "plugins": [
    "tensorflow"
  ]
}

Known limitations

  • Currently built only for babel 7.
  • tf must be the name TensorFlow is imported as.

This is still just a prototype. Suggestions and PRs are welcome!