Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yorkie/tensorflow-nodejs
TensorFlow Node.js provides idiomatic JavaScript language bindings and a high layer API for Node.js users. TensorFlow Node.js provides idiomatic JavaScript language bindings and a high layer API for Node.js users.
https://github.com/yorkie/tensorflow-nodejs
nodejs tensorflow tensorflow-node
Last synced: 29 days ago
JSON representation
TensorFlow Node.js provides idiomatic JavaScript language bindings and a high layer API for Node.js users. TensorFlow Node.js provides idiomatic JavaScript language bindings and a high layer API for Node.js users.
- Host: GitHub
- URL: https://github.com/yorkie/tensorflow-nodejs
- Owner: yorkie
- License: mit
- Created: 2017-07-11T02:35:13.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-10-09T23:09:25.000Z (about 4 years ago)
- Last Synced: 2024-10-30T04:50:01.418Z (about 1 month ago)
- Topics: nodejs, tensorflow, tensorflow-node
- Language: JavaScript
- Homepage: https://npmjs.org/package/tensorflow2
- Size: 298 KB
- Stars: 579
- Watchers: 32
- Forks: 88
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-nodejs - tensorflow-nodejs - TensorFlow Node.js provides idiomatic JavaScript language bindings and a high layer API for Node.js users. ![](https://img.shields.io/github/stars/yorkie/tensorflow-nodejs.svg?style=social&label=Star) (Repository / Machine learning & Neural networks)
- awesome-github-star - tensorflow-nodejs
- awesome-imgcook - yorkie/tensorflow-nodejs - TensorFlow Node.js provides idiomatic JavaScript language bindings and a high layer API for Node.js users. (JavaScript packages for machine learning / Neural networks)
README
# for Node.js
| NPM | Dependency | Build | Coverage |
|-----|------------|-------|----------|
|[![NPM version][npm-image]][npm-url]|[![Dependency Status][david-image]][david-url]|[![Build Status][travis-image]][travis-url]|[![Coverage][coveralls-image]][coveralls-url][npm-image]: https://img.shields.io/npm/v/tensorflow2.svg?style=flat-square
[npm-url]: https://npmjs.org/package/tensorflow2
[travis-image]: https://img.shields.io/travis/yorkie/tensorflow-nodejs.svg?style=flat-square
[travis-url]: https://travis-ci.org/yorkie/tensorflow-nodejs
[david-image]: http://img.shields.io/david/yorkie/tensorflow-nodejs.svg?style=flat-square
[david-url]: https://david-dm.org/yorkie/tensorflow-nodejs
[coveralls-image]: https://img.shields.io/codecov/c/github/yorkie/tensorflow-nodejs.svg?style=flat-square
[coveralls-url]: https://codecov.io/github/yorkie/tensorflow-nodejs?branch=masterThis library wraps [Tensorflow][] Python for Node.js developers, it's powered by [@pipcook/boa](https://github.com/alibaba/pipcook/blob/master/docs/manual/intro-to-boa.md).
**Notice:** This project is still under active development and not guaranteed to have a
stable API. This is especially true because the underlying TensorFlow C API has not yet
been stabilized as well.## Installation
```sh
$ npm install tensorflow2 --save
```## Usage
```js
const tf = require('tensorflow2');// load mnist dataset.
const dataset = tf.keras.dataset.mnist();
// {
// train: { x: [Getter], y: [Getter] },
// test: { x: [Getter], y: [Getter] }
// }// create model.
const model = tf.keras.models.Sequential([
tf.keras.layers.Flatten({
input_shape: [28, 28]
}),
tf.keras.layers.Dense(128, {
activation: 'relu'
}),
tf.keras.layers.Dropout(0.2),
tf.keras.layers.Dense(10)
]);
model.summary();// compile the model.
const loss_fn = tf.keras.losses.SparseCategoricalCrossentropy({ from_logits: true });
model.compile({
optimizer: 'adam',
loss: loss_fn,
metrics: [ 'accuracy' ],
});// train the model.
model.fit(dataset.train.x, dataset.train.y, { epochs: 5 });// save the model
model.save('your-model.h5');
```See [example/mnist.js](./example/mnist.js) for complete example.
## Tests
```sh
$ npm test
```## License
[MIT](./LICENSE) licensed @ 2020
[TensorFlow]: http://tensorflow.org