• Stars
    star
    578
  • Rank 77,250 (Top 2 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 7 years ago
  • Updated about 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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.

TensorFlow for Node.js

NPM Dependency Build Coverage
NPM version Dependency Status Build Status Coverage

This library wraps Tensorflow Python for Node.js developers, it's powered by @pipcook/boa.

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

$ npm install tensorflow2 --save

Usage

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 for complete example.

Tests

$ npm test

License

MIT licensed @ 2020

More Repositories

1

react-native-wechat

🚀 WeChat login, share, favorite and payment for React-Native on iOS and Android platforms (QQ: 336021910)
Objective-C
2,912
star
2

rust.js

Run your JavaScript apps backed by Rust
Rust
150
star
3

me

CV at Github and Notes based on Issues
70
star
4

lv

compile your JavaScript to native code in pure JavaScript
Roff
19
star
5

serve

a tiny server for serving static files and website, no any other runtime required based on mongoose.
C
18
star
6

node-orgmode

The orgmode implementation for Node.js which contains a search engine and a parser written in Parser Combinator
JavaScript
16
star
7

ios-tbb

Thread Building Block for iOS and iOS Simulator
C++
8
star
8

yorkie.github.io

yorkie site
HTML
8
star
9

uv-mongo

async mongo library based on libuv and clibs
C
8
star
10

rust-imap

an imap implementation for rust
Rust
7
star
11

express-model

deprecated project
JavaScript
5
star
12

node-ifconfig-parser

ifconfig text parser
JavaScript
5
star
13

ikanbao.fm

电子报在线阅读第三方平台 based on Express.js
JavaScript
5
star
14

watjs

Write WebAssembly Text Format Files(.wat) in JavaScript
JavaScript
4
star
15

node-ifconfig

ifconfig port for nodejs
JavaScript
3
star
16

stream-slice

slice stream like buffer/string
JavaScript
3
star
17

node-loaderio

loader.io api wrapper for nodejs
JavaScript
3
star
18

node-naoqi

Connects NAOqi robots in Node.js
JavaScript
3
star
19

node-sexp

Creates symboltic-expression builder in JavaScript.
JavaScript
3
star
20

node-gitlog-parser

parse git log stream(Readable)
JavaScript
3
star
21

node-httpmocker

configurable HTTP/s stubbed-tool for nodejs
JavaScript
2
star
22

browser-cli

A html render in your shell
JavaScript
2
star
23

node-bypass

config your bypass of proxy by using `networksetup` tool
JavaScript
2
star
24

node-x509-builder

x509 certificate builder from buffer(tls)
JavaScript
2
star
25

name-your-function

Just rename your anonymous function in ES6.
JavaScript
2
star
26

rsync-ignore

It helps rsync to parse a `.rsyncignore` file for a project like other `.gitignore` and `.npmignore`.
JavaScript
2
star
27

nasm-example

just a example for learning nasm
Assembly
2
star
28

ADBHttpRequest

A XMLHttpRequest re-implementation that based on the ADB transfer
1
star
29

node-get-signal

cross-platform system signal tool for nodejs
JavaScript
1
star
30

JTLS

TLS implementation in pure javascript
JavaScript
1
star
31

node-tls-header

Generating TLS Header in pure javascript.
JavaScript
1
star
32

node-buffer24

node buffer extension: support 24bit operators
JavaScript
1
star
33

node-mongoose-connectionstate

a little gateway to mongoose state
JavaScript
1
star
34

node-mongo-url

mongo url generator for nodejs
JavaScript
1
star
35

process-once.node

The `pthread_once(3)` binding to the Node.js community.
C++
1
star
36

node-rainbow-console

colorize your console for NodeJS
JavaScript
1
star
37

nginx-lang-redirect.lua

The Lua Script for supporting language redirections working with proxy_pass for Nginx/OpenResty
Lua
1
star
38

chrome.sh

Chrome Shortcut for opening url with your Terminal
Shell
1
star
39

FlashDB

A database system for providing a local, fast, convenient accessor, which can query, extend and remove. And it's support Multi-keys.
1
star
40

esprima-to-value

convert an esprima ast object/literal to an real object
JavaScript
1
star
41

node-comongo

mongo coroutinue library for nodejs
JavaScript
1
star
42

node-hash-array

hashify array and get element by its key
JavaScript
1
star
43

node-ext2type

convert extension of the path to the http Content-Type format, like application/xml, application/json.
JavaScript
1
star