Quantcast

TensorFlow.js

TensorFlow.js wiki, TensorFlow.js review, TensorFlow.js history, TensorFlow.js motto, TensorFlow.js ownership TensorFlow.js news, what is TensorFlow.js TensorFlow.js wikipedia
TensorFlow.js designer, TensorFlow.js sales, TensorFlow.js facts

TensorFlow.js[3][4]​ - A WebGL accelerated, browser based JavaScript library for training and deploying ML models.

 

TensorFlow.js is an open source WebGL-accelerated JavaScript library for machine intelligence. It brings highly performant machine learning building blocks to your fingertips, allowing you to train neural networks in a browser or run pre-trained models in inference mode. See Getting Started[1]​ for a guide on installing/configuring TensorFlow.js.

 

TensorFlow.js provides low-level building blocks for machine learning as well as a high-level, Keras-inspired API for constructing neural networks. Let's take a look at some of the core components of the library.

 

Features

  • Develop ML in the Browser: Use flexible and intuitive APIs to build and train models from scratch using the low-level JavaScript linear algebra library or the high-level layers API
  • Run Existing models: Use TensorFlow.js model converters to run pre-existing TensorFlow models right in the browser.
  • Retrain Existing models: Retrain pre-existing ML models using sensor data connected to the browser, or other client-side data.

Getting Started

There are two main ways to get TensorFlow.js in your JavaScript project: via script tags or by installing it from NPM and using a build tool like Parcel, WebPack, or Rollup. 

 

via Script Tag

<html>
<head>
<!-- Load TensorFlow.js -->
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@0.10.0"> </script>
<!-- Place your code in the script tag below. You can also use an external .js file -->
<script>
// Notice there is no 'import' statement. 'tf' is available on the index-page
// because of the script tag above.
// Define a model for linear regression.
const model = tf.sequential();
model.add(tf.layers.dense({units: 1, inputShape: [1]}));

// Prepare the model for training: Specify the loss and the optimizer.
model.compile({loss: 'meanSquaredError', optimizer: 'sgd'});

// Generate some synthetic data for training.
const xs = tf.tensor2d([1, 2, 3, 4], [4, 1]);
const ys = tf.tensor2d([1, 3, 5, 7], [4, 1]);

// Train the model using the data.
model.fit(xs, ys).then(() => {
// Use the model to do inference on a data point the model hasn't seen before:
// Open the browser devtools to see the output
model.predict(tf.tensor2d([5], [1, 1])).print(); });
</script>
</head>
<body>
</body>
</html>

via NPM

 

# install tensorflow.js
yarn add @tensorflow/tfjs
# or
npm install @tensorflow/tfjs


import * as tf from '@tensorflow/tfjs';

// Define a model for linear regression.
const model = tf.sequential();
model.add(tf.layers.dense({units: 1, inputShape: [1]}));

// Prepare the model for training: Specify the loss and the optimizer.
model.compile({loss: 'meanSquaredError', optimizer: 'sgd'});

// Generate some synthetic data for training.
const xs = tf.tensor2d([1, 2, 3, 4], [4, 1]);
const ys = tf.tensor2d([1, 3, 5, 7], [4, 1]);

// Train the model using the data.
model.fit(xs, ys).then(() => {
// Use the model to do inference on a data point the model hasn't seen before:
model.predict(tf.tensor2d([5], [1, 1])).print();
});

 

All information for TensorFlow.js's wiki comes from the below links. Any source is valid, including Twitter, Facebook, Instagram, and LinkedIn. Pictures, videos, biodata, and files relating to TensorFlow.js are also acceptable encyclopedic sources.
This is a discussion about TensorFlow.js. Concerns about the topic, its accuracy, inclusion of information etc. should be discussed here. Off-topic discussion not pertaining to TensorFlow.js or this wiki will be removed.
Other wiki pages related to TensorFlow.js.
Created: 05/05/2018 03:07:06 PM UTC
Last Modified: 05/05/2018 03:22:17 PM UTC