Tensorflow.js Introduction - GeeksforGeeks

15 Aug, 2021What is Tensorflow.js?TensorFlow.js is a JavaScript library for training and deploying machine learning models on web applications and in Node.js. You can develop the machine learning models from scratch using tensorflow.js or can use the APIs provided to train your existing models in the browser or on your Node.js server.To learn more you can directly go to this link: https://www.tensorflow.org/resources/learn-ml/basics-of-tensorflow-for-js-development.Prerequisite: Before starting Tensorflow.js, you need to know the following:For browser:HTML: Basics knowledge of HTML is requiredJavaScript: Good knowledge of JS is required For server-side:Node.js: Having a good command of Node.js. Also since Node.js is a JS runtime, so having command over JavaScript would help a lot.Other requirements:NPM or Yarn: These are packages that need to be installed in your system.Setting Up Tensorflow.js:Browser Setup There are two ways to add TensorFlow.js in your browser-based application:Using script tags.Installation from NPM1. Using Script tags: Add the following script tag to your main HTML file.<script src=”https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@2.0.0/dist/tf.min.js”></script>Example:HTMLHTML<!DOCTYPE html><html lang="en">  <head>    <script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@2.0.0/dist/tf.min.js">    </script></head>  <body>    <script>          // Value of a scalar        var value = "Hello Geeks! Tensorflow here."          // Creating the value of a scalar        var tens = tf.scalar(value)          document.write(tens)    </script></body>  </html> Output:2. Using NPM/ yarn: We can either use NPM or Yarn to install tensorflow.js.yarn add @tensorflow/tfjsornpm install @tensorflow/tfjsNode.js Setup:Option 1: Install TensorFlow.js with native C++ bindings.yarn add @tensorflow/tfjs-nodeornpm install @tensorflow/tfjs-nodeOption 2: (Linux Only) If your system has a NVIDIA® GPU with CUDA support, use the GPU package even for higher performance.yarn add @tensorflow/tfjs-node-gpuornpm install @tensorflow/tfjs-node-gpuOption 3: Install the pure JavaScript version. This is the slowest option performance-wise.yarn add @tensorflow/tfjsornpm install @tensorflow/tfjsMy Personal Notes
arrow_drop_upSave

Like0PreviousTensorFlow.js Browser Complete ReferenceNext
Tensorflow.js tf.backend() FunctionRecommended ArticlesPage :Introduction to Apache Maven | A build automation tool for Java projects17, May 18Introduction to React Native07, Jun 17Introduction to Apache POI17, Jul 17Apache Kafka | Introduction28, Aug 17Introduction of Firewall in Computer Network31, Aug 17WordPress Introduction23, Jul 18Introduction to Object Oriented Programming in JavaScript18, Sep 17ReactJS | Introduction to JSX09, Mar 18React.js (Introduction and Working)27, Sep 17Introduction to Web Scraping06, Nov 19PHP | MySQL Database Introduction22, Nov 17jQuery | Introduction29, Jan 18Django Introduction | Set 2 (Creating a Project)01, Feb 18Introduction to JavaScript29, Jan 20Introduction to Xamarin | A Software for Mobile App Development and App Creation16, Mar 18ReactJS | Calculator App ( Introduction )25, Mar 18CSS Introduction10, Apr 18Introduction to Web Development and the Holy Trinity of it27, Apr 18Introduction to Postman for API Development28, May 18Ajax Introduction09, Jul 18XHTML | Introduction31, Aug 18REST API (Introduction)02, Sep 18Introduction to JavaScript Course | Learn how to Build a task tracker using JavaScript24, Apr 19Introduction to Scripting Languages21, Sep 18Article Contributed By :ghoshsuman0129@ghoshsuman0129Vote for difficultyEasy
Normal
Medium
Hard
ExpertArticle Tags :Tensorflow.jsJavaScriptWeb TechnologiesImprove ArticleReport IssueWriting code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Load CommentsWhat's NewInterview Series- Prepare, Practice & UpskillView DetailsData Structures & Algorithms- Self Paced CourseView DetailsComplete Interview PreparationView DetailsMost popular in JavaScriptRemove elements from a JavaScript ArrayConvert a string to an integer in JavaScriptDifference between var, let and const keywords in JavaScriptDifferences between Functional Components and Class Components in ReactHow to calculate the number of days between two dates in javascript?Most visited in Web TechnologiesRemove elements from a JavaScript ArrayInstallation of Node.js on LinuxConvert a string to an integer in JavaScriptHow to fetch data from an API in ReactJS ?How to insert spaces/tabs in text using HTML/CSS?Improve your Coding Skills with PracticeTry It!
5th Floor, A-118,Sector-136, Noida, Uttar Pradesh - 201305
feedback@geeksforgeeks.orgCompanyAbout UsCareersIn MediaContact UsPrivacy PolicyCopyright PolicyLearnAlgorithmsData StructuresSDE Cheat SheetMachine learningCS SubjectsVideo TutorialsNewsTop NewsTechnologyWork & CareerBusinessFinanceLifestyleLanguagesPythonJavaCPPGolangC#SQLWeb DevelopmentWeb TutorialsDjango TutorialHTMLCSSJavaScriptBootstrapContributeWrite an ArticleImprove an ArticlePick Topics to WriteWrite Interview ExperienceInternshipsVideo Internship@geeksforgeeks
, Some rights reserved 
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
        Privacy Policy

Got It !
Start Your Coding Journey Now!Login
Register
Tensorflow.js tf.tensor() Function
Tensorflow.js tf.scalar() Function
TenserFlow.js Tensors Creation Complete Reference
Tensorflow.js tf.Tensor class .buffer() Method
Tensorflow.js tf.Tensor class .bufferSync() Method
TensorFlow.js Tensors Classes Complete Reference
Tensorflow.js tf.booleanMaskAsync() Function
Tensorflow.js tf.concat() Function
TensorFlow.js Tensors Transformations Complete Reference
TensorFlow.js Slicing and Joining Complete Reference
Tensorflow.js tf.einsum() Function
Tensorflow.js tf.multinomial() Function
TensorFlow.js Tensor Random Complete Reference
Tensorflow.js Introduction
Tensorflow.js tf.input() Function
Tensorflow.js tf.loadGraphModel() Function
Tensorflow.js tf.io.http() Function
TensorFlow.js Models Loading Complete Reference
Tensorflow.js tf.io.copyModel() Function
Tensorflow.js tf.io.listModels() Function
Tensorflow.js tf.io.moveModel() Function
TensorFlow.js Models Management Complete Reference
Tensorflow.js tf.GraphModel Class
Tensorflow.js tf.GraphModel class .save() Method
Tensorflow.js tf.GraphModel class .predict() Method
Tensorflow.js tf.GraphModel class .execute() Method
TensorFlow.js Models Classes Complete Reference
Tensorflow.js Introduction
Tensorflow.js tf.layers.elu() Function
Tensorflow.js tf.layers.activation() Function
TensorFlow.js Layers Basic Complete Reference
Tensorflow.js tf.layers.conv1d() Function
TensorFlow.js Layers Convolutional Complete Reference
Tensorflow.js tf.layers.add() Function
TensorFlow.js Layers Merge Complete Reference
Tensorflow.js tf.layers.globalAveragePooling1d() Function
TensorFlow.js Layers Pooling Complete Reference
TensorFlow.js Layers Noise Complete Reference
Tensorflow.js tf.layers.bidirectional() Function
Tensorflow.js tf.layers.timeDistributed() Function
TensorFlow.js Layers Classes Complete Reference
Tensorflow.js tf.layers.zeroPadding2d() Function
Tensorflow.js tf.layers.masking() Function
Tensorflow.js Introduction
TensorFlow.js Operations Arithmetic Complete Reference
TensorFlow.js Operations Basic Math Complete Reference
TensorFlow.js Operations Matrices Complete Reference
TensorFlow.js Operations Normalization Complete Reference
TensorFlow.js Operations Images Complete Reference
TensorFlow.js Operations Logical Complete Reference
TensorFlow.js Operations Evaluation Complete Reference
Tensorflow.js tf.cumsum() Function
TensorFlow.js Operations Slicing and Joining Complete Reference
TensorFlow.js Operations Spectral Complete Reference
Tensorflow.js tf.unsortedSegmentSum() Function
Tensorflow.js tf.movingAverage() Function
Tensorflow.js tf.dropout() Function
TensorFlow.js Operations Signal Complete Reference
Tensorflow.js tf.linalg.bandPart() Function
Tensorflow.js tf.linalg.gramSchmidt() Function
Tensorflow.js tf.linalg.qr() Function
TensorFlow.js Operations Sparse Complete Reference
Tensorflow.js Introduction
Tensorflow.js tf.grad() Function
Tensorflow.js tf.grads() Function
Tensorflow.js tf.customGrad() Function
TensorFlow.js Training Gradients Complete ReferenceTensorflow.js TrainingTensorflow.js tf.train.momentum() FunctionTensorflow.js tf.train.adagrad() FunctionTensorFlow.js Training Optimizers Complete ReferenceTensorflow.js tf.losses.absoluteDifference() FunctionTensorflow.js tf.losses.computeWeightedLoss() FunctionTensorflow.js tf.losses.cosineDistance() FunctionTensorFlow.js Training Losses Complete ReferenceTensorflow.js tf.train.Optimizer ClassTensorflow.js tf.train.Optimizer class .minimize() MethodTensorFlow.js Training Classes Complete ReferenceTensorflow.js IntroductionTensorflow.js tf.time() FunctionTensorflow.js tf.nextFrame() FunctionTensorflow.js tf.profile() FunctionTensorFlow.js Performance Memory Complete ReferenceTensorflow.js PerformanceTensorflow.js tf.disposeVariables() FunctionTensorflow.js tf.enableDebugMode() FunctionTensorflow.js tf.enableProdMode() FunctionTensorflow.js tf.engine() FunctionTensorflow.js EnvironmentTensorFlow.js Environment Complete ReferenceTensorflow.js IntroductionTensorflow.js tf.metrics.binaryAccuracy() FunctionTensorflow.js tf.metrics.binaryCrossentropy() FunctionTensorflow.js tf.metrics.categoricalAccuracy() FunctionTensorflow.js tf.metrics.categoricalCrossentropy() FunctionTensorflow.js tf.metrics.cosineProximity() FunctionTensorflow.js ConstraintsTensorflow.js tf.metrics.meanSquaredError() FunctionTensorflow.js tf.metrics.precision() FunctionTensorflow.js tf.metrics.recall() FunctionTensorflow.js tf.metrics.sparseCategoricalAccuracy() FunctionTensorFlow.js Metrics Complete ReferenceTensorflow.js IntroductionTensorflow.js tf.initializers.Initializer ClassTensorflow.js tf.initializers.constant() MethodTensorflow.js tf.initializers.glorotNormal() FunctionTensorflow.js tf.initializers.glorotUniform() FunctionTensorflow.js tf.initializers.heNormal() FunctionTensorflow.js tf.initializers.heUniform() FunctionTensorflow.js InitializersTensorFlow.js Initializers Complete ReferenceTensorflow.js IntroductionTensorflow.js tf.regularizers.l1() FunctionTensorflow.js tf.regularizers.l1l2() FunctionTensorflow.js tf.regularizers.l2() FunctionTensorflow.js IntroductionTensorflow.js tf.data.csv() FunctionTensorflow.js tf.data.generator() FunctionTensorflow.js tf.data.microphone() FunctionTensorflow.js RegularizesTensorFlow.js Data Creation Complete ReferenceTensorflow.js tf.data.zip() FunctionTensorflow.js tf.data.Dataset class .batch() MethodTensorflow.js DataTensorFlow.js Data Classes Complete ReferencesTensorflow.js IntroductionTensorflow.js tf.util.assert() FunctionTensorflow.js tf.util.createShuffledIndices() FunctionTensorflow.js tf.decodeString() FunctionTensorflow.js tf.encodeString() FunctionTensorflow.js tf.fetch() FunctionTensorflow.js tf.util.flatten() FunctionTensorflow.js tf.util.now() FunctionTensorflow.js tf.util.shuffle() FunctionTensorflow.js tf.util.shuffleCombo() FunctionTensorflow.js UtilTensorflow.js tf.browser.fromPixels() FunctionTensorflow.js tf.browser.fromPixelsAsync() FunctionTensorflow.js tf.browser.toPixels() FunctionTensorFlow.js Browser Complete ReferenceTensorflow.js IntroductionTensorflow.js tf.backend() FunctionTensorflow.js tf.getBackend() FunctionTensorflow.js tf.ready() FunctionTensorflow.js tf.registerBackend() FunctionTensorflow.js tf.removeBackend() FunctionTensorflow.js tf.setBackend() FunctionTensorflow.js BrowserTensorflow.js tf.callbacks.earlyStopping() FunctionTensorflow.js BackendsTensorflow.js MetricsTable of ContentsTensorFlow.jsTensorflow.js IntroductionTensorflow.js TensorsTensorflow.js tf.tensor() FunctionTensorflow.js tf.scalar() FunctionTenserFlow.js Tensors Creation Complete ReferenceTensorflow.js tf.Tensor class .buffer() MethodTensorflow.js tf.Tensor class .bufferSync() MethodTensorFlow.js Tensors Classes Complete ReferenceTensorflow.js tf.booleanMaskAsync() FunctionTensorflow.js tf.concat() FunctionTensorFlow.js Tensors Transformations Complete ReferenceTensorFlow.js Slicing and Joining Complete ReferenceTensorflow.js tf.einsum() FunctionTensorflow.js tf.multinomial() FunctionTensorFlow.js Tensor Random Complete ReferenceTensorflow.js IntroductionTensorflow.js ModelsTensorflow.js tf.input() FunctionTensorflow.js tf.loadGraphModel() FunctionTensorflow.js tf.io.http() FunctionTensorFlow.js Models Loading Complete ReferenceTensorflow.js tf.io.copyModel() FunctionTensorflow.js tf.io.listModels() FunctionTensorflow.js tf.io.moveModel() FunctionTensorFlow.js Models Management Complete ReferenceTensorflow.js tf.GraphModel ClassTensorflow.js tf.GraphModel class .save() MethodTensorflow.js tf.GraphModel class .predict() MethodTensorflow.js tf.GraphModel class .execute() MethodTensorFlow.js Models Classes Complete ReferenceTensorflow.js IntroductionTensorflow.js tf.layers.elu() FunctionTensorflow.js LayersTensorflow.js tf.layers.activation() FunctionTensorFlow.js Layers Basic Complete ReferenceTensorflow.js tf.layers.conv1d() FunctionTensorFlow.js Layers Convolutional Complete ReferenceTensorflow.js tf.layers.add() FunctionTensorFlow.js Layers Merge Complete ReferenceTensorflow.js tf.layers.globalAveragePooling1d() FunctionTensorFlow.js Layers Pooling Complete ReferenceTensorFlow.js Layers Noise Complete ReferenceTensorflow.js tf.layers.bidirectional() FunctionTensorflow.js tf.layers.timeDistributed() FunctionTensorFlow.js Layers Classes Complete ReferenceTensorflow.js tf.layers.zeroPadding2d() FunctionTensorflow.js tf.layers.masking() FunctionTensorflow.js IntroductionTensorFlow.js Operations Arithmetic Complete ReferenceTensorFlow.js Operations Basic Math Complete ReferenceTensorFlow.js Operations Matrices Complete ReferenceTensorflow.js OperationsTensorFlow.js Operations Normalization Complete ReferenceTensorFlow.js Operations Images Complete ReferenceTensorFlow.js Operations Logical Complete ReferenceTensorFlow.js Operations Evaluation Complete ReferenceTensorflow.js tf.cumsum() FunctionTensorFlow.js Operations Slicing and Joining Complete ReferenceTensorFlow.js Operations Spectral Complete ReferenceTensorflow.js tf.unsortedSegmentSum() FunctionTensorflow.js tf.movingAverage() FunctionTensorflow.js tf.dropout() FunctionTensorFlow.js Operations Signal Complete ReferenceTensorflow.js tf.linalg.bandPart() FunctionTensorflow.js tf.linalg.gramSchmidt() FunctionTensorflow.js tf.linalg.qr() FunctionTensorFlow.js Operations Sparse Complete ReferenceTensorflow.js IntroductionTensorflow.js tf.grad() FunctionTensorflow.js tf.grads() FunctionTensorflow.js tf.customGrad() FunctionTensorFlow.js Training Gradients Complete ReferenceTensorflow.js TrainingTensorflow.js tf.train.momentum() FunctionTensorflow.js tf.train.adagrad() FunctionTensorFlow.js Training Optimizers Complete ReferenceTensorflow.js tf.losses.absoluteDifference() FunctionTensorflow.js tf.losses.computeWeightedLoss() FunctionTensorflow.js tf.losses.cosineDistance() FunctionTensorFlow.js Training Losses Complete ReferenceTensorflow.js tf.train.Optimizer ClassTensorflow.js tf.train.Optimizer class .minimize() MethodTensorFlow.js Training Classes Complete ReferenceTensorflow.js IntroductionTensorflow.js tf.time() FunctionTensorflow.js tf.nextFrame() FunctionTensorflow.js tf.profile() FunctionTensorFlow.js Performance Memory Complete ReferenceTensorflow.js PerformanceTensorflow.js tf.disposeVariables() FunctionTensorflow.js tf.enableDebugMode() FunctionTensorflow.js tf.enableProdMode() FunctionTensorflow.js tf.engine() FunctionTensorflow.js EnvironmentTensorFlow.js Environment Complete ReferenceTensorflow.js IntroductionTensorflow.js tf.metrics.binaryAccuracy() FunctionTensorflow.js tf.metrics.binaryCrossentropy() FunctionTensorflow.js tf.metrics.categoricalAccuracy() FunctionTensorflow.js tf.metrics.categoricalCrossentropy() FunctionTensorflow.js tf.metrics.cosineProximity() FunctionTensorflow.js ConstraintsTensorflow.js tf.metrics.meanSquaredError() FunctionTensorflow.js tf.metrics.precision() FunctionTensorflow.js tf.metrics.recall() FunctionTensorflow.js tf.metrics.sparseCategoricalAccuracy() FunctionTensorFlow.js Metrics Complete ReferenceTensorflow.js IntroductionTensorflow.js tf.initializers.Initializer ClassTensorflow.js tf.initializers.constant() MethodTensorflow.js tf.initializers.glorotNormal() FunctionTensorflow.js tf.initializers.glorotUniform() FunctionTensorflow.js tf.initializers.heNormal() FunctionTensorflow.js tf.initializers.heUniform() FunctionTensorflow.js InitializersTensorFlow.js Initializers Complete ReferenceTensorflow.js IntroductionTensorflow.js tf.regularizers.l1() FunctionTensorflow.js tf.regularizers.l1l2() FunctionTensorflow.js tf.regularizers.l2() FunctionTensorflow.js IntroductionTensorflow.js tf.data.csv() FunctionTensorflow.js tf.data.generator() FunctionTensorflow.js tf.data.microphone() FunctionTensorflow.js RegularizesTensorFlow.js Data Creation Complete ReferenceTensorflow.js tf.data.zip() FunctionTensorflow.js tf.data.Dataset class .batch() MethodTensorflow.js DataTensorFlow.js Data Classes Complete ReferencesTensorflow.js IntroductionTensorflow.js tf.util.assert() FunctionTensorflow.js tf.util.createShuffledIndices() FunctionTensorflow.js tf.decodeString() FunctionTensorflow.js tf.encodeString() FunctionTensorflow.js tf.fetch() FunctionTensorflow.js tf.util.flatten() FunctionTensorflow.js tf.util.now() FunctionTensorflow.js tf.util.shuffle() FunctionTensorflow.js tf.util.shuffleCombo() FunctionTensorflow.js UtilTensorflow.js tf.browser.fromPixels() FunctionTensorflow.js tf.browser.fromPixelsAsync() FunctionTensorflow.js tf.browser.toPixels() FunctionTensorFlow.js Browser Complete ReferenceTensorflow.js IntroductionTensorflow.js tf.backend() FunctionTensorflow.js tf.getBackend() FunctionTensorflow.js tf.ready() FunctionTensorflow.js tf.registerBackend() FunctionTensorflow.js tf.removeBackend() FunctionTensorflow.js tf.setBackend() FunctionTensorflow.js BrowserTensorflow.js tf.callbacks.earlyStopping() FunctionTensorflow.js BackendsTensorflow.js MetricsImprove Article

Save Article

Like Article

Tensorflow.js IntroductionLast Updated :
15 Aug, 2021What is Tensorflow.js?TensorFlow.js is a JavaScript library for training and deploying machine learning models on web applications and in Node.js. You can develop the machine learning models from scratch using tensorflow.js or can use the APIs provided to train your existing models in the browser or on your Node.js server.To learn more you can directly go to this link: https://www.tensorflow.org/resources/learn-ml/basics-of-tensorflow-for-js-development.Prerequisite: Before starting Tensorflow.js, you need to know the following:For browser:HTML: Basics knowledge of HTML is requiredJavaScript: Good knowledge of JS is required For server-side:Node.js: Having a good command of Node.js. Also since Node.js is a JS runtime, so having command over JavaScript would help a lot.Other requirements:NPM or Yarn: These are packages that need to be installed in your system.Setting Up Tensorflow.js:Browser Setup There are two ways to add TensorFlow.js in your browser-based application:Using script tags.Installation from NPM1. Using Script tags: Add the following script tag to your main HTML file.<script src=”https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@2.0.0/dist/tf.min.js”></script>Example:HTMLHTML<!DOCTYPE html><html lang="en">  <head>    <script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@2.0.0/dist/tf.min.js">    </script></head>  <body>    <script>          // Value of a scalar        var value = "Hello Geeks! Tensorflow here."          // Creating the value of a scalar        var tens = tf.scalar(value)          document.write(tens)    </script></body>  </html> Output:2. Using NPM/ yarn: We can either use NPM or Yarn to install tensorflow.js.yarn add @tensorflow/tfjsornpm install @tensorflow/tfjsNode.js Setup:Option 1: Install TensorFlow.js with native C++ bindings.yarn add @tensorflow/tfjs-nodeornpm install @tensorflow/tfjs-nodeOption 2: (Linux Only) If your system has a NVIDIA® GPU with CUDA support, use the GPU package even for higher performance.yarn add @tensorflow/tfjs-node-gpuornpm install @tensorflow/tfjs-node-gpuOption 3: Install the pure JavaScript version. This is the slowest option performance-wise.yarn add @tensorflow/tfjsornpm install @tensorflow/tfjsMy Personal Notes
arrow_drop_upSave

Like0PreviousTensorFlow.js Browser Complete ReferenceNext
Tensorflow.js tf.backend() FunctionRecommended ArticlesPage :Introduction to Apache Maven | A build automation tool for Java projects17, May 18Introduction to React Native07, Jun 17Introduction to Apache POI17, Jul 17Apache Kafka | Introduction28, Aug 17Introduction of Firewall in Computer Network31, Aug 17WordPress Introduction23, Jul 18Introduction to Object Oriented Programming in JavaScript18, Sep 17ReactJS | Introduction to JSX09, Mar 18React.js (Introduction and Working)27, Sep 17Introduction to Web Scraping06, Nov 19PHP | MySQL Database Introduction22, Nov 17jQuery | Introduction29, Jan 18Django Introduction | Set 2 (Creating a Project)01, Feb 18Introduction to JavaScript29, Jan 20Introduction to Xamarin | A Software for Mobile App Development and App Creation16, Mar 18ReactJS | Calculator App ( Introduction )25, Mar 18CSS Introduction10, Apr 18Introduction to Web Development and the Holy Trinity of it27, Apr 18Introduction to Postman for API Development28, May 18Ajax Introduction09, Jul 18XHTML | Introduction31, Aug 18REST API (Introduction)02, Sep 18Introduction to JavaScript Course | Learn how to Build a task tracker using JavaScript24, Apr 19Introduction to Scripting Languages21, Sep 18Article Contributed By :ghoshsuman0129@ghoshsuman0129Vote for difficultyEasy
Normal
Medium
Hard
ExpertArticle Tags :Tensorflow.jsJavaScriptWeb TechnologiesImprove ArticleReport IssueWriting code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Load CommentsWhat's NewInterview Series- Prepare, Practice & UpskillView DetailsData Structures & Algorithms- Self Paced CourseView DetailsComplete Interview PreparationView DetailsMost popular in JavaScriptRemove elements from a JavaScript ArrayConvert a string to an integer in JavaScriptDifference between var, let and const keywords in JavaScriptDifferences between Functional Components and Class Components in ReactHow to calculate the number of days between two dates in javascript?Most visited in Web TechnologiesRemove elements from a JavaScript ArrayInstallation of Node.js on LinuxConvert a string to an integer in JavaScriptHow to fetch data from an API in ReactJS ?How to insert spaces/tabs in text using HTML/CSS?Improve your Coding Skills with PracticeTry It!
5th Floor, A-118,Sector-136, Noida, Uttar Pradesh - 201305
feedback@geeksforgeeks.orgCompanyAbout UsCareersIn MediaContact UsPrivacy PolicyCopyright PolicyLearnAlgorithmsData StructuresSDE Cheat SheetMachine learningCS SubjectsVideo TutorialsNewsTop NewsTechnologyWork & CareerBusinessFinanceLifestyleLanguagesPythonJavaCPPGolangC#SQLWeb DevelopmentWeb TutorialsDjango TutorialHTMLCSSJavaScriptBootstrapContributeWrite an ArticleImprove an ArticlePick Topics to WriteWrite Interview ExperienceInternshipsVideo Internship@geeksforgeeks
, Some rights reserved 
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
        Privacy Policy

Got It !
Start Your Coding Journey Now!Login
Register
Tensorflow.js tf.train.momentum() Function
Tensorflow.js tf.train.adagrad() Function
TensorFlow.js Training Optimizers Complete Reference
Tensorflow.js tf.losses.absoluteDifference() Function
Tensorflow.js tf.losses.computeWeightedLoss() Function
Tensorflow.js tf.losses.cosineDistance() Function
TensorFlow.js Training Losses Complete Reference
Tensorflow.js tf.train.Optimizer Class
Tensorflow.js tf.train.Optimizer class .minimize() Method
TensorFlow.js Training Classes Complete Reference
Tensorflow.js Introduction
Tensorflow.js tf.time() Function
Tensorflow.js tf.nextFrame() Function
Tensorflow.js tf.profile() Function
TensorFlow.js Performance Memory Complete Reference
Tensorflow.js tf.disposeVariables() Function
Tensorflow.js tf.enableDebugMode() Function
Tensorflow.js tf.enableProdMode() Function
Tensorflow.js tf.engine() FunctionTensorflow.js EnvironmentTensorFlow.js Environment Complete ReferenceTensorflow.js IntroductionTensorflow.js tf.metrics.binaryAccuracy() FunctionTensorflow.js tf.metrics.binaryCrossentropy() FunctionTensorflow.js tf.metrics.categoricalAccuracy() FunctionTensorflow.js tf.metrics.categoricalCrossentropy() FunctionTensorflow.js tf.metrics.cosineProximity() FunctionTensorflow.js ConstraintsTensorflow.js tf.metrics.meanSquaredError() FunctionTensorflow.js tf.metrics.precision() FunctionTensorflow.js tf.metrics.recall() FunctionTensorflow.js tf.metrics.sparseCategoricalAccuracy() FunctionTensorFlow.js Metrics Complete ReferenceTensorflow.js IntroductionTensorflow.js tf.initializers.Initializer ClassTensorflow.js tf.initializers.constant() MethodTensorflow.js tf.initializers.glorotNormal() FunctionTensorflow.js tf.initializers.glorotUniform() FunctionTensorflow.js tf.initializers.heNormal() FunctionTensorflow.js tf.initializers.heUniform() FunctionTensorflow.js InitializersTensorFlow.js Initializers Complete ReferenceTensorflow.js IntroductionTensorflow.js tf.regularizers.l1() FunctionTensorflow.js tf.regularizers.l1l2() FunctionTensorflow.js tf.regularizers.l2() FunctionTensorflow.js IntroductionTensorflow.js tf.data.csv() FunctionTensorflow.js tf.data.generator() FunctionTensorflow.js tf.data.microphone() FunctionTensorflow.js RegularizesTensorFlow.js Data Creation Complete ReferenceTensorflow.js tf.data.zip() FunctionTensorflow.js tf.data.Dataset class .batch() MethodTensorflow.js DataTensorFlow.js Data Classes Complete ReferencesTensorflow.js IntroductionTensorflow.js tf.util.assert() FunctionTensorflow.js tf.util.createShuffledIndices() FunctionTensorflow.js tf.decodeString() FunctionTensorflow.js tf.encodeString() FunctionTensorflow.js tf.fetch() FunctionTensorflow.js tf.util.flatten() FunctionTensorflow.js tf.util.now() FunctionTensorflow.js tf.util.shuffle() FunctionTensorflow.js tf.util.shuffleCombo() FunctionTensorflow.js UtilTensorflow.js tf.browser.fromPixels() FunctionTensorflow.js tf.browser.fromPixelsAsync() FunctionTensorflow.js tf.browser.toPixels() FunctionTensorFlow.js Browser Complete ReferenceTensorflow.js IntroductionTensorflow.js tf.backend() FunctionTensorflow.js tf.getBackend() FunctionTensorflow.js tf.ready() FunctionTensorflow.js tf.registerBackend() FunctionTensorflow.js tf.removeBackend() FunctionTensorflow.js tf.setBackend() FunctionTensorflow.js BrowserTensorflow.js tf.callbacks.earlyStopping() FunctionTensorflow.js BackendsTensorflow.js Metrics
TensorFlow.js Environment Complete Reference
Tensorflow.js Introduction
Tensorflow.js tf.metrics.binaryAccuracy() Function
Tensorflow.js tf.metrics.binaryCrossentropy() Function
Tensorflow.js tf.metrics.categoricalAccuracy() Function
Tensorflow.js tf.metrics.categoricalCrossentropy() Function
Tensorflow.js tf.metrics.cosineProximity() Function
Tensorflow.js tf.metrics.meanSquaredError() Function
Tensorflow.js tf.metrics.precision() Function
Tensorflow.js tf.metrics.recall() Function
Tensorflow.js tf.metrics.sparseCategoricalAccuracy() Function
TensorFlow.js Metrics Complete Reference
Tensorflow.js Introduction
Tensorflow.js tf.initializers.Initializer Class
Tensorflow.js tf.initializers.constant() Method
Tensorflow.js tf.initializers.glorotNormal() Function
Tensorflow.js tf.initializers.glorotUniform() Function
Tensorflow.js tf.initializers.heNormal() Function
Tensorflow.js tf.initializers.heUniform() Function
TensorFlow.js Initializers Complete Reference
Tensorflow.js Introduction
Tensorflow.js tf.regularizers.l1() Function
Tensorflow.js tf.regularizers.l1l2() Function
Tensorflow.js tf.regularizers.l2() Function
Tensorflow.js Introduction
Tensorflow.js tf.data.csv() Function
Tensorflow.js tf.data.generator() Function
Tensorflow.js tf.data.microphone() FunctionTensorflow.js RegularizesTensorFlow.js Data Creation Complete ReferenceTensorflow.js tf.data.zip() FunctionTensorflow.js tf.data.Dataset class .batch() MethodTensorflow.js DataTensorFlow.js Data Classes Complete ReferencesTensorflow.js IntroductionTensorflow.js tf.util.assert() FunctionTensorflow.js tf.util.createShuffledIndices() FunctionTensorflow.js tf.decodeString() FunctionTensorflow.js tf.encodeString() FunctionTensorflow.js tf.fetch() FunctionTensorflow.js tf.util.flatten() FunctionTensorflow.js tf.util.now() FunctionTensorflow.js tf.util.shuffle() FunctionTensorflow.js tf.util.shuffleCombo() FunctionTensorflow.js UtilTensorflow.js tf.browser.fromPixels() FunctionTensorflow.js tf.browser.fromPixelsAsync() FunctionTensorflow.js tf.browser.toPixels() FunctionTensorFlow.js Browser Complete ReferenceTensorflow.js IntroductionTensorflow.js tf.backend() FunctionTensorflow.js tf.getBackend() FunctionTensorflow.js tf.ready() FunctionTensorflow.js tf.registerBackend() FunctionTensorflow.js tf.removeBackend() FunctionTensorflow.js tf.setBackend() FunctionTensorflow.js BrowserTensorflow.js tf.callbacks.earlyStopping() FunctionTensorflow.js BackendsTensorflow.js Metrics
TensorFlow.js Data Creation Complete Reference
Tensorflow.js tf.data.zip() Function
Tensorflow.js tf.data.Dataset class .batch() Method
TensorFlow.js Data Classes Complete References
Tensorflow.js Introduction
Tensorflow.js tf.util.assert() Function
Tensorflow.js tf.util.createShuffledIndices() Function
Tensorflow.js tf.decodeString() Function
Tensorflow.js tf.encodeString() Function
Tensorflow.js tf.fetch() Function
Tensorflow.js tf.util.flatten() Function
Tensorflow.js tf.util.now() Function
Tensorflow.js tf.util.shuffle() Function
Tensorflow.js tf.util.shuffleCombo() Function
Tensorflow.js tf.browser.fromPixels() Function
Tensorflow.js tf.browser.fromPixelsAsync() Function
Tensorflow.js tf.browser.toPixels() Function
TensorFlow.js Browser Complete Reference
Tensorflow.js Introduction
Tensorflow.js tf.backend() Function
Tensorflow.js tf.getBackend() Function
Tensorflow.js tf.ready() Function
Tensorflow.js tf.registerBackend() Function
Tensorflow.js tf.removeBackend() Function
Tensorflow.js tf.setBackend() Function
Tensorflow.js tf.callbacks.earlyStopping() Function
TensorFlow.js
Tensorflow.js IntroductionTensorflow.js TensorsTensorflow.js tf.tensor() FunctionTensorflow.js tf.scalar() FunctionTenserFlow.js Tensors Creation Complete ReferenceTensorflow.js tf.Tensor class .buffer() MethodTensorflow.js tf.Tensor class .bufferSync() MethodTensorFlow.js Tensors Classes Complete ReferenceTensorflow.js tf.booleanMaskAsync() FunctionTensorflow.js tf.concat() FunctionTensorFlow.js Tensors Transformations Complete ReferenceTensorFlow.js Slicing and Joining Complete ReferenceTensorflow.js tf.einsum() FunctionTensorflow.js tf.multinomial() FunctionTensorFlow.js Tensor Random Complete ReferenceTensorflow.js IntroductionTensorflow.js ModelsTensorflow.js tf.input() FunctionTensorflow.js tf.loadGraphModel() FunctionTensorflow.js tf.io.http() FunctionTensorFlow.js Models Loading Complete ReferenceTensorflow.js tf.io.copyModel() FunctionTensorflow.js tf.io.listModels() FunctionTensorflow.js tf.io.moveModel() FunctionTensorFlow.js Models Management Complete ReferenceTensorflow.js tf.GraphModel ClassTensorflow.js tf.GraphModel class .save() MethodTensorflow.js tf.GraphModel class .predict() MethodTensorflow.js tf.GraphModel class .execute() MethodTensorFlow.js Models Classes Complete ReferenceTensorflow.js IntroductionTensorflow.js tf.layers.elu() FunctionTensorflow.js LayersTensorflow.js tf.layers.activation() FunctionTensorFlow.js Layers Basic Complete ReferenceTensorflow.js tf.layers.conv1d() FunctionTensorFlow.js Layers Convolutional Complete ReferenceTensorflow.js tf.layers.add() FunctionTensorFlow.js Layers Merge Complete ReferenceTensorflow.js tf.layers.globalAveragePooling1d() FunctionTensorFlow.js Layers Pooling Complete ReferenceTensorFlow.js Layers Noise Complete ReferenceTensorflow.js tf.layers.bidirectional() FunctionTensorflow.js tf.layers.timeDistributed() FunctionTensorFlow.js Layers Classes Complete ReferenceTensorflow.js tf.layers.zeroPadding2d() FunctionTensorflow.js tf.layers.masking() FunctionTensorflow.js IntroductionTensorFlow.js Operations Arithmetic Complete ReferenceTensorFlow.js Operations Basic Math Complete ReferenceTensorFlow.js Operations Matrices Complete ReferenceTensorflow.js OperationsTensorFlow.js Operations Normalization Complete ReferenceTensorFlow.js Operations Images Complete ReferenceTensorFlow.js Operations Logical Complete ReferenceTensorFlow.js Operations Evaluation Complete ReferenceTensorflow.js tf.cumsum() FunctionTensorFlow.js Operations Slicing and Joining Complete ReferenceTensorFlow.js Operations Spectral Complete ReferenceTensorflow.js tf.unsortedSegmentSum() FunctionTensorflow.js tf.movingAverage() FunctionTensorflow.js tf.dropout() FunctionTensorFlow.js Operations Signal Complete ReferenceTensorflow.js tf.linalg.bandPart() FunctionTensorflow.js tf.linalg.gramSchmidt() FunctionTensorflow.js tf.linalg.qr() FunctionTensorFlow.js Operations Sparse Complete ReferenceTensorflow.js IntroductionTensorflow.js tf.grad() FunctionTensorflow.js tf.grads() FunctionTensorflow.js tf.customGrad() FunctionTensorFlow.js Training Gradients Complete ReferenceTensorflow.js TrainingTensorflow.js tf.train.momentum() FunctionTensorflow.js tf.train.adagrad() FunctionTensorFlow.js Training Optimizers Complete ReferenceTensorflow.js tf.losses.absoluteDifference() FunctionTensorflow.js tf.losses.computeWeightedLoss() FunctionTensorflow.js tf.losses.cosineDistance() FunctionTensorFlow.js Training Losses Complete ReferenceTensorflow.js tf.train.Optimizer ClassTensorflow.js tf.train.Optimizer class .minimize() MethodTensorFlow.js Training Classes Complete ReferenceTensorflow.js IntroductionTensorflow.js tf.time() FunctionTensorflow.js tf.nextFrame() FunctionTensorflow.js tf.profile() FunctionTensorFlow.js Performance Memory Complete ReferenceTensorflow.js PerformanceTensorflow.js tf.disposeVariables() FunctionTensorflow.js tf.enableDebugMode() FunctionTensorflow.js tf.enableProdMode() FunctionTensorflow.js tf.engine() FunctionTensorflow.js EnvironmentTensorFlow.js Environment Complete ReferenceTensorflow.js IntroductionTensorflow.js tf.metrics.binaryAccuracy() FunctionTensorflow.js tf.metrics.binaryCrossentropy() FunctionTensorflow.js tf.metrics.categoricalAccuracy() FunctionTensorflow.js tf.metrics.categoricalCrossentropy() FunctionTensorflow.js tf.metrics.cosineProximity() FunctionTensorflow.js ConstraintsTensorflow.js tf.metrics.meanSquaredError() FunctionTensorflow.js tf.metrics.precision() FunctionTensorflow.js tf.metrics.recall() FunctionTensorflow.js tf.metrics.sparseCategoricalAccuracy() FunctionTensorFlow.js Metrics Complete ReferenceTensorflow.js IntroductionTensorflow.js tf.initializers.Initializer ClassTensorflow.js tf.initializers.constant() MethodTensorflow.js tf.initializers.glorotNormal() FunctionTensorflow.js tf.initializers.glorotUniform() FunctionTensorflow.js tf.initializers.heNormal() FunctionTensorflow.js tf.initializers.heUniform() FunctionTensorflow.js InitializersTensorFlow.js Initializers Complete ReferenceTensorflow.js IntroductionTensorflow.js tf.regularizers.l1() FunctionTensorflow.js tf.regularizers.l1l2() FunctionTensorflow.js tf.regularizers.l2() FunctionTensorflow.js IntroductionTensorflow.js tf.data.csv() FunctionTensorflow.js tf.data.generator() FunctionTensorflow.js tf.data.microphone() FunctionTensorflow.js RegularizesTensorFlow.js Data Creation Complete ReferenceTensorflow.js tf.data.zip() FunctionTensorflow.js tf.data.Dataset class .batch() MethodTensorflow.js DataTensorFlow.js Data Classes Complete ReferencesTensorflow.js IntroductionTensorflow.js tf.util.assert() FunctionTensorflow.js tf.util.createShuffledIndices() FunctionTensorflow.js tf.decodeString() FunctionTensorflow.js tf.encodeString() FunctionTensorflow.js tf.fetch() FunctionTensorflow.js tf.util.flatten() FunctionTensorflow.js tf.util.now() FunctionTensorflow.js tf.util.shuffle() FunctionTensorflow.js tf.util.shuffleCombo() FunctionTensorflow.js UtilTensorflow.js tf.browser.fromPixels() FunctionTensorflow.js tf.browser.fromPixelsAsync() FunctionTensorflow.js tf.browser.toPixels() FunctionTensorFlow.js Browser Complete ReferenceTensorflow.js IntroductionTensorflow.js tf.backend() FunctionTensorflow.js tf.getBackend() FunctionTensorflow.js tf.ready() FunctionTensorflow.js tf.registerBackend() FunctionTensorflow.js tf.removeBackend() FunctionTensorflow.js tf.setBackend() FunctionTensorflow.js BrowserTensorflow.js tf.callbacks.earlyStopping() FunctionTensorflow.js BackendsTensorflow.js MetricsImprove Article

Save Article

Like Article

Tensorflow.js IntroductionLast Updated :
15 Aug, 2021What is Tensorflow.js?TensorFlow.js is a JavaScript library for training and deploying machine learning models on web applications and in Node.js. You can develop the machine learning models from scratch using tensorflow.js or can use the APIs provided to train your existing models in the browser or on your Node.js server.To learn more you can directly go to this link: https://www.tensorflow.org/resources/learn-ml/basics-of-tensorflow-for-js-development.Prerequisite: Before starting Tensorflow.js, you need to know the following:For browser:HTML: Basics knowledge of HTML is requiredJavaScript: Good knowledge of JS is required For server-side:Node.js: Having a good command of Node.js. Also since Node.js is a JS runtime, so having command over JavaScript would help a lot.Other requirements:NPM or Yarn: These are packages that need to be installed in your system.Setting Up Tensorflow.js:Browser Setup There are two ways to add TensorFlow.js in your browser-based application:Using script tags.Installation from NPM1. Using Script tags: Add the following script tag to your main HTML file.<script src=”https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@2.0.0/dist/tf.min.js”></script>Example:HTMLHTML<!DOCTYPE html><html lang="en">  <head>    <script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@2.0.0/dist/tf.min.js">    </script></head>  <body>    <script>          // Value of a scalar        var value = "Hello Geeks! Tensorflow here."          // Creating the value of a scalar        var tens = tf.scalar(value)          document.write(tens)    </script></body>  </html> Output:2. Using NPM/ yarn: We can either use NPM or Yarn to install tensorflow.js.yarn add @tensorflow/tfjsornpm install @tensorflow/tfjsNode.js Setup:Option 1: Install TensorFlow.js with native C++ bindings.yarn add @tensorflow/tfjs-nodeornpm install @tensorflow/tfjs-nodeOption 2: (Linux Only) If your system has a NVIDIA® GPU with CUDA support, use the GPU package even for higher performance.yarn add @tensorflow/tfjs-node-gpuornpm install @tensorflow/tfjs-node-gpuOption 3: Install the pure JavaScript version. This is the slowest option performance-wise.yarn add @tensorflow/tfjsornpm install @tensorflow/tfjsMy Personal Notes
arrow_drop_upSave

Like0PreviousTensorFlow.js Browser Complete ReferenceNext
Tensorflow.js tf.backend() FunctionRecommended ArticlesPage :Introduction to Apache Maven | A build automation tool for Java projects17, May 18Introduction to React Native07, Jun 17Introduction to Apache POI17, Jul 17Apache Kafka | Introduction28, Aug 17Introduction of Firewall in Computer Network31, Aug 17WordPress Introduction23, Jul 18Introduction to Object Oriented Programming in JavaScript18, Sep 17ReactJS | Introduction to JSX09, Mar 18React.js (Introduction and Working)27, Sep 17Introduction to Web Scraping06, Nov 19PHP | MySQL Database Introduction22, Nov 17jQuery | Introduction29, Jan 18Django Introduction | Set 2 (Creating a Project)01, Feb 18Introduction to JavaScript29, Jan 20Introduction to Xamarin | A Software for Mobile App Development and App Creation16, Mar 18ReactJS | Calculator App ( Introduction )25, Mar 18CSS Introduction10, Apr 18Introduction to Web Development and the Holy Trinity of it27, Apr 18Introduction to Postman for API Development28, May 18Ajax Introduction09, Jul 18XHTML | Introduction31, Aug 18REST API (Introduction)02, Sep 18Introduction to JavaScript Course | Learn how to Build a task tracker using JavaScript24, Apr 19Introduction to Scripting Languages21, Sep 18Article Contributed By :ghoshsuman0129@ghoshsuman0129Vote for difficultyEasy
Normal
Medium
Hard
ExpertArticle Tags :Tensorflow.jsJavaScriptWeb TechnologiesImprove ArticleReport IssueWriting code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Load CommentsWhat's NewInterview Series- Prepare, Practice & UpskillView DetailsData Structures & Algorithms- Self Paced CourseView DetailsComplete Interview PreparationView DetailsMost popular in JavaScriptRemove elements from a JavaScript ArrayConvert a string to an integer in JavaScriptDifference between var, let and const keywords in JavaScriptDifferences between Functional Components and Class Components in ReactHow to calculate the number of days between two dates in javascript?Most visited in Web TechnologiesRemove elements from a JavaScript ArrayInstallation of Node.js on LinuxConvert a string to an integer in JavaScriptHow to fetch data from an API in ReactJS ?How to insert spaces/tabs in text using HTML/CSS?
Tensorflow.js tf.tensor() Function
Tensorflow.js tf.scalar() Function
TenserFlow.js Tensors Creation Complete Reference
Tensorflow.js tf.Tensor class .buffer() Method
Tensorflow.js tf.Tensor class .bufferSync() Method
TensorFlow.js Tensors Classes Complete Reference
Tensorflow.js tf.booleanMaskAsync() Function
Tensorflow.js tf.concat() Function
TensorFlow.js Tensors Transformations Complete Reference
TensorFlow.js Slicing and Joining Complete Reference
Tensorflow.js tf.einsum() Function
Tensorflow.js tf.multinomial() Function
TensorFlow.js Tensor Random Complete Reference
Tensorflow.js Introduction
Tensorflow.js tf.input() Function
Tensorflow.js tf.loadGraphModel() Function
Tensorflow.js tf.io.http() Function
TensorFlow.js Models Loading Complete Reference
Tensorflow.js tf.io.copyModel() Function
Tensorflow.js tf.io.listModels() Function
Tensorflow.js tf.io.moveModel() Function
TensorFlow.js Models Management Complete Reference
Tensorflow.js tf.GraphModel Class
Tensorflow.js tf.GraphModel class .save() Method
Tensorflow.js tf.GraphModel class .predict() Method
Tensorflow.js tf.GraphModel class .execute() Method
TensorFlow.js Models Classes Complete Reference
Tensorflow.js Introduction
Tensorflow.js tf.layers.elu() Function
Tensorflow.js tf.layers.activation() Function
TensorFlow.js Layers Basic Complete Reference
Tensorflow.js tf.layers.conv1d() Function
TensorFlow.js Layers Convolutional Complete Reference
Tensorflow.js tf.layers.add() Function
TensorFlow.js Layers Merge Complete Reference
Tensorflow.js tf.layers.globalAveragePooling1d() Function
TensorFlow.js Layers Pooling Complete Reference
TensorFlow.js Layers Noise Complete Reference
Tensorflow.js tf.layers.bidirectional() Function
Tensorflow.js tf.layers.timeDistributed() Function
TensorFlow.js Layers Classes Complete Reference
Tensorflow.js tf.layers.zeroPadding2d() Function
Tensorflow.js tf.layers.masking() Function
Tensorflow.js Introduction
TensorFlow.js Operations Arithmetic Complete Reference
TensorFlow.js Operations Basic Math Complete Reference
TensorFlow.js Operations Matrices Complete Reference
TensorFlow.js Operations Normalization Complete Reference
TensorFlow.js Operations Images Complete Reference
TensorFlow.js Operations Logical Complete Reference
TensorFlow.js Operations Evaluation Complete Reference
Tensorflow.js tf.cumsum() Function
TensorFlow.js Operations Slicing and Joining Complete Reference
TensorFlow.js Operations Spectral Complete Reference
Tensorflow.js tf.unsortedSegmentSum() Function
Tensorflow.js tf.movingAverage() Function
Tensorflow.js tf.dropout() Function
TensorFlow.js Operations Signal Complete Reference
Tensorflow.js tf.linalg.bandPart() Function
Tensorflow.js tf.linalg.gramSchmidt() Function
Tensorflow.js tf.linalg.qr() Function
TensorFlow.js Operations Sparse Complete Reference
Tensorflow.js Introduction
Tensorflow.js tf.grad() Function
Tensorflow.js tf.grads() Function
Tensorflow.js tf.customGrad() Function
TensorFlow.js Training Gradients Complete ReferenceTensorflow.js TrainingTensorflow.js tf.train.momentum() FunctionTensorflow.js tf.train.adagrad() FunctionTensorFlow.js Training Optimizers Complete ReferenceTensorflow.js tf.losses.absoluteDifference() FunctionTensorflow.js tf.losses.computeWeightedLoss() FunctionTensorflow.js tf.losses.cosineDistance() FunctionTensorFlow.js Training Losses Complete ReferenceTensorflow.js tf.train.Optimizer ClassTensorflow.js tf.train.Optimizer class .minimize() MethodTensorFlow.js Training Classes Complete ReferenceTensorflow.js IntroductionTensorflow.js tf.time() FunctionTensorflow.js tf.nextFrame() FunctionTensorflow.js tf.profile() FunctionTensorFlow.js Performance Memory Complete ReferenceTensorflow.js PerformanceTensorflow.js tf.disposeVariables() FunctionTensorflow.js tf.enableDebugMode() FunctionTensorflow.js tf.enableProdMode() FunctionTensorflow.js tf.engine() FunctionTensorflow.js EnvironmentTensorFlow.js Environment Complete ReferenceTensorflow.js IntroductionTensorflow.js tf.metrics.binaryAccuracy() FunctionTensorflow.js tf.metrics.binaryCrossentropy() FunctionTensorflow.js tf.metrics.categoricalAccuracy() FunctionTensorflow.js tf.metrics.categoricalCrossentropy() FunctionTensorflow.js tf.metrics.cosineProximity() FunctionTensorflow.js ConstraintsTensorflow.js tf.metrics.meanSquaredError() FunctionTensorflow.js tf.metrics.precision() FunctionTensorflow.js tf.metrics.recall() FunctionTensorflow.js tf.metrics.sparseCategoricalAccuracy() FunctionTensorFlow.js Metrics Complete ReferenceTensorflow.js IntroductionTensorflow.js tf.initializers.Initializer ClassTensorflow.js tf.initializers.constant() MethodTensorflow.js tf.initializers.glorotNormal() FunctionTensorflow.js tf.initializers.glorotUniform() FunctionTensorflow.js tf.initializers.heNormal() FunctionTensorflow.js tf.initializers.heUniform() FunctionTensorflow.js InitializersTensorFlow.js Initializers Complete ReferenceTensorflow.js IntroductionTensorflow.js tf.regularizers.l1() FunctionTensorflow.js tf.regularizers.l1l2() FunctionTensorflow.js tf.regularizers.l2() FunctionTensorflow.js IntroductionTensorflow.js tf.data.csv() FunctionTensorflow.js tf.data.generator() FunctionTensorflow.js tf.data.microphone() FunctionTensorflow.js RegularizesTensorFlow.js Data Creation Complete ReferenceTensorflow.js tf.data.zip() FunctionTensorflow.js tf.data.Dataset class .batch() MethodTensorflow.js DataTensorFlow.js Data Classes Complete ReferencesTensorflow.js IntroductionTensorflow.js tf.util.assert() FunctionTensorflow.js tf.util.createShuffledIndices() FunctionTensorflow.js tf.decodeString() FunctionTensorflow.js tf.encodeString() FunctionTensorflow.js tf.fetch() FunctionTensorflow.js tf.util.flatten() FunctionTensorflow.js tf.util.now() FunctionTensorflow.js tf.util.shuffle() FunctionTensorflow.js tf.util.shuffleCombo() FunctionTensorflow.js UtilTensorflow.js tf.browser.fromPixels() FunctionTensorflow.js tf.browser.fromPixelsAsync() FunctionTensorflow.js tf.browser.toPixels() FunctionTensorFlow.js Browser Complete ReferenceTensorflow.js IntroductionTensorflow.js tf.backend() FunctionTensorflow.js tf.getBackend() FunctionTensorflow.js tf.ready() FunctionTensorflow.js tf.registerBackend() FunctionTensorflow.js tf.removeBackend() FunctionTensorflow.js tf.setBackend() FunctionTensorflow.js BrowserTensorflow.js tf.callbacks.earlyStopping() FunctionTensorflow.js BackendsTensorflow.js MetricsImprove Article

Save Article

Like Article

Tensorflow.js IntroductionLast Updated :
15 Aug, 2021What is Tensorflow.js?TensorFlow.js is a JavaScript library for training and deploying machine learning models on web applications and in Node.js. You can develop the machine learning models from scratch using tensorflow.js or can use the APIs provided to train your existing models in the browser or on your Node.js server.To learn more you can directly go to this link: https://www.tensorflow.org/resources/learn-ml/basics-of-tensorflow-for-js-development.Prerequisite: Before starting Tensorflow.js, you need to know the following:For browser:HTML: Basics knowledge of HTML is requiredJavaScript: Good knowledge of JS is required For server-side:Node.js: Having a good command of Node.js. Also since Node.js is a JS runtime, so having command over JavaScript would help a lot.Other requirements:NPM or Yarn: These are packages that need to be installed in your system.Setting Up Tensorflow.js:Browser Setup There are two ways to add TensorFlow.js in your browser-based application:Using script tags.Installation from NPM1. Using Script tags: Add the following script tag to your main HTML file.<script src=”https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@2.0.0/dist/tf.min.js”></script>Example:HTMLHTML<!DOCTYPE html><html lang="en">  <head>    <script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@2.0.0/dist/tf.min.js">    </script></head>  <body>    <script>          // Value of a scalar        var value = "Hello Geeks! Tensorflow here."          // Creating the value of a scalar        var tens = tf.scalar(value)          document.write(tens)    </script></body>  </html> Output:2. Using NPM/ yarn: We can either use NPM or Yarn to install tensorflow.js.yarn add @tensorflow/tfjsornpm install @tensorflow/tfjsNode.js Setup:Option 1: Install TensorFlow.js with native C++ bindings.yarn add @tensorflow/tfjs-nodeornpm install @tensorflow/tfjs-nodeOption 2: (Linux Only) If your system has a NVIDIA® GPU with CUDA support, use the GPU package even for higher performance.yarn add @tensorflow/tfjs-node-gpuornpm install @tensorflow/tfjs-node-gpuOption 3: Install the pure JavaScript version. This is the slowest option performance-wise.yarn add @tensorflow/tfjsornpm install @tensorflow/tfjsMy Personal Notes
arrow_drop_upSave

Like0PreviousTensorFlow.js Browser Complete ReferenceNext
Tensorflow.js tf.backend() FunctionRecommended ArticlesPage :Introduction to Apache Maven | A build automation tool for Java projects17, May 18Introduction to React Native07, Jun 17Introduction to Apache POI17, Jul 17Apache Kafka | Introduction28, Aug 17Introduction of Firewall in Computer Network31, Aug 17WordPress Introduction23, Jul 18Introduction to Object Oriented Programming in JavaScript18, Sep 17ReactJS | Introduction to JSX09, Mar 18React.js (Introduction and Working)27, Sep 17Introduction to Web Scraping06, Nov 19PHP | MySQL Database Introduction22, Nov 17jQuery | Introduction29, Jan 18Django Introduction | Set 2 (Creating a Project)01, Feb 18Introduction to JavaScript29, Jan 20Introduction to Xamarin | A Software for Mobile App Development and App Creation16, Mar 18ReactJS | Calculator App ( Introduction )25, Mar 18CSS Introduction10, Apr 18Introduction to Web Development and the Holy Trinity of it27, Apr 18Introduction to Postman for API Development28, May 18Ajax Introduction09, Jul 18XHTML | Introduction31, Aug 18REST API (Introduction)02, Sep 18Introduction to JavaScript Course | Learn how to Build a task tracker using JavaScript24, Apr 19Introduction to Scripting Languages21, Sep 18Article Contributed By :ghoshsuman0129@ghoshsuman0129Vote for difficultyEasy
Normal
Medium
Hard
ExpertArticle Tags :Tensorflow.jsJavaScriptWeb TechnologiesImprove ArticleReport IssueWriting code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Load CommentsWhat's NewInterview Series- Prepare, Practice & UpskillView DetailsData Structures & Algorithms- Self Paced CourseView DetailsComplete Interview PreparationView DetailsMost popular in JavaScriptRemove elements from a JavaScript ArrayConvert a string to an integer in JavaScriptDifference between var, let and const keywords in JavaScriptDifferences between Functional Components and Class Components in ReactHow to calculate the number of days between two dates in javascript?Most visited in Web TechnologiesRemove elements from a JavaScript ArrayInstallation of Node.js on LinuxConvert a string to an integer in JavaScriptHow to fetch data from an API in ReactJS ?How to insert spaces/tabs in text using HTML/CSS?
Tensorflow.js tf.train.momentum() Function
Tensorflow.js tf.train.adagrad() Function
TensorFlow.js Training Optimizers Complete Reference
Tensorflow.js tf.losses.absoluteDifference() Function
Tensorflow.js tf.losses.computeWeightedLoss() Function
Tensorflow.js tf.losses.cosineDistance() Function
TensorFlow.js Training Losses Complete Reference
Tensorflow.js tf.train.Optimizer Class
Tensorflow.js tf.train.Optimizer class .minimize() Method
TensorFlow.js Training Classes Complete Reference
Tensorflow.js Introduction
Tensorflow.js tf.time() Function
Tensorflow.js tf.nextFrame() Function
Tensorflow.js tf.profile() Function
TensorFlow.js Performance Memory Complete Reference
Tensorflow.js tf.disposeVariables() Function
Tensorflow.js tf.enableDebugMode() Function
Tensorflow.js tf.enableProdMode() Function
Tensorflow.js tf.engine() FunctionTensorflow.js EnvironmentTensorFlow.js Environment Complete ReferenceTensorflow.js IntroductionTensorflow.js tf.metrics.binaryAccuracy() FunctionTensorflow.js tf.metrics.binaryCrossentropy() FunctionTensorflow.js tf.metrics.categoricalAccuracy() FunctionTensorflow.js tf.metrics.categoricalCrossentropy() FunctionTensorflow.js tf.metrics.cosineProximity() FunctionTensorflow.js ConstraintsTensorflow.js tf.metrics.meanSquaredError() FunctionTensorflow.js tf.metrics.precision() FunctionTensorflow.js tf.metrics.recall() FunctionTensorflow.js tf.metrics.sparseCategoricalAccuracy() FunctionTensorFlow.js Metrics Complete ReferenceTensorflow.js IntroductionTensorflow.js tf.initializers.Initializer ClassTensorflow.js tf.initializers.constant() MethodTensorflow.js tf.initializers.glorotNormal() FunctionTensorflow.js tf.initializers.glorotUniform() FunctionTensorflow.js tf.initializers.heNormal() FunctionTensorflow.js tf.initializers.heUniform() FunctionTensorflow.js InitializersTensorFlow.js Initializers Complete ReferenceTensorflow.js IntroductionTensorflow.js tf.regularizers.l1() FunctionTensorflow.js tf.regularizers.l1l2() FunctionTensorflow.js tf.regularizers.l2() FunctionTensorflow.js IntroductionTensorflow.js tf.data.csv() FunctionTensorflow.js tf.data.generator() FunctionTensorflow.js tf.data.microphone() FunctionTensorflow.js RegularizesTensorFlow.js Data Creation Complete ReferenceTensorflow.js tf.data.zip() FunctionTensorflow.js tf.data.Dataset class .batch() MethodTensorflow.js DataTensorFlow.js Data Classes Complete ReferencesTensorflow.js IntroductionTensorflow.js tf.util.assert() FunctionTensorflow.js tf.util.createShuffledIndices() FunctionTensorflow.js tf.decodeString() FunctionTensorflow.js tf.encodeString() FunctionTensorflow.js tf.fetch() FunctionTensorflow.js tf.util.flatten() FunctionTensorflow.js tf.util.now() FunctionTensorflow.js tf.util.shuffle() FunctionTensorflow.js tf.util.shuffleCombo() FunctionTensorflow.js UtilTensorflow.js tf.browser.fromPixels() FunctionTensorflow.js tf.browser.fromPixelsAsync() FunctionTensorflow.js tf.browser.toPixels() FunctionTensorFlow.js Browser Complete ReferenceTensorflow.js IntroductionTensorflow.js tf.backend() FunctionTensorflow.js tf.getBackend() FunctionTensorflow.js tf.ready() FunctionTensorflow.js tf.registerBackend() FunctionTensorflow.js tf.removeBackend() FunctionTensorflow.js tf.setBackend() FunctionTensorflow.js BrowserTensorflow.js tf.callbacks.earlyStopping() FunctionTensorflow.js BackendsTensorflow.js Metrics
TensorFlow.js Environment Complete Reference
Tensorflow.js Introduction
Tensorflow.js tf.metrics.binaryAccuracy() Function
Tensorflow.js tf.metrics.binaryCrossentropy() Function
Tensorflow.js tf.metrics.categoricalAccuracy() Function
Tensorflow.js tf.metrics.categoricalCrossentropy() Function
Tensorflow.js tf.metrics.cosineProximity() Function
Tensorflow.js tf.metrics.meanSquaredError() Function
Tensorflow.js tf.metrics.precision() Function
Tensorflow.js tf.metrics.recall() Function
Tensorflow.js tf.metrics.sparseCategoricalAccuracy() Function
TensorFlow.js Metrics Complete Reference
Tensorflow.js Introduction
Tensorflow.js tf.initializers.Initializer Class
Tensorflow.js tf.initializers.constant() Method
Tensorflow.js tf.initializers.glorotNormal() Function
Tensorflow.js tf.initializers.glorotUniform() Function
Tensorflow.js tf.initializers.heNormal() Function
Tensorflow.js tf.initializers.heUniform() Function
TensorFlow.js Initializers Complete Reference
Tensorflow.js Introduction
Tensorflow.js tf.regularizers.l1() Function
Tensorflow.js tf.regularizers.l1l2() Function
Tensorflow.js tf.regularizers.l2() Function
Tensorflow.js Introduction
Tensorflow.js tf.data.csv() Function
Tensorflow.js tf.data.generator() Function
Tensorflow.js tf.data.microphone() FunctionTensorflow.js RegularizesTensorFlow.js Data Creation Complete ReferenceTensorflow.js tf.data.zip() FunctionTensorflow.js tf.data.Dataset class .batch() MethodTensorflow.js DataTensorFlow.js Data Classes Complete ReferencesTensorflow.js IntroductionTensorflow.js tf.util.assert() FunctionTensorflow.js tf.util.createShuffledIndices() FunctionTensorflow.js tf.decodeString() FunctionTensorflow.js tf.encodeString() FunctionTensorflow.js tf.fetch() FunctionTensorflow.js tf.util.flatten() FunctionTensorflow.js tf.util.now() FunctionTensorflow.js tf.util.shuffle() FunctionTensorflow.js tf.util.shuffleCombo() FunctionTensorflow.js UtilTensorflow.js tf.browser.fromPixels() FunctionTensorflow.js tf.browser.fromPixelsAsync() FunctionTensorflow.js tf.browser.toPixels() FunctionTensorFlow.js Browser Complete ReferenceTensorflow.js IntroductionTensorflow.js tf.backend() FunctionTensorflow.js tf.getBackend() FunctionTensorflow.js tf.ready() FunctionTensorflow.js tf.registerBackend() FunctionTensorflow.js tf.removeBackend() FunctionTensorflow.js tf.setBackend() FunctionTensorflow.js BrowserTensorflow.js tf.callbacks.earlyStopping() FunctionTensorflow.js BackendsTensorflow.js Metrics
TensorFlow.js Data Creation Complete Reference
Tensorflow.js tf.data.zip() Function
Tensorflow.js tf.data.Dataset class .batch() Method
TensorFlow.js Data Classes Complete References
Tensorflow.js Introduction
Tensorflow.js tf.util.assert() Function
Tensorflow.js tf.util.createShuffledIndices() Function
Tensorflow.js tf.decodeString() Function
Tensorflow.js tf.encodeString() Function
Tensorflow.js tf.fetch() Function
Tensorflow.js tf.util.flatten() Function
Tensorflow.js tf.util.now() Function
Tensorflow.js tf.util.shuffle() Function
Tensorflow.js tf.util.shuffleCombo() Function
Tensorflow.js tf.browser.fromPixels() Function
Tensorflow.js tf.browser.fromPixelsAsync() Function
Tensorflow.js tf.browser.toPixels() Function
TensorFlow.js Browser Complete Reference
Tensorflow.js Introduction
Tensorflow.js tf.backend() Function
Tensorflow.js tf.getBackend() Function
Tensorflow.js tf.ready() Function
Tensorflow.js tf.registerBackend() Function
Tensorflow.js tf.removeBackend() Function
Tensorflow.js tf.setBackend() Function
Tensorflow.js tf.callbacks.earlyStopping() Function
Last Updated :
15 Aug, 2021
TensorFlow.js is a JavaScript library for training and deploying machine learning models on web applications and in Node.js. You can develop the machine learning models from scratch using tensorflow.js or can use the APIs provided to train your existing models in the browser or on your Node.js server.
To learn more you can directly go to this link: https://www.tensorflow.org/resources/learn-ml/basics-of-tensorflow-for-js-development.
Prerequisite: Before starting Tensorflow.js, you need to know the following:
For browser:
HTML: Basics knowledge of HTML is required
JavaScript: Good knowledge of JS is required
 
For server-side:
Node.js: Having a good command of Node.js. Also since Node.js is a JS runtime, so having command over JavaScript would help a lot.
Other requirements:
NPM or Yarn: These are packages that need to be installed in your system.
Setting Up Tensorflow.js:
Browser Setup There are two ways to add TensorFlow.js in your browser-based application:
Using script tags.
Installation from NPM
1. Using Script tags: Add the following script tag to your main HTML file.
<script src=”https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@2.0.0/dist/tf.min.js”></script>
Example:
HTML
<!DOCTYPE html><html lang="en">  <head>    <script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@2.0.0/dist/tf.min.js">    </script></head>  <body>    <script>          // Value of a scalar        var value = "Hello Geeks! Tensorflow here."          // Creating the value of a scalar        var tens = tf.scalar(value)          document.write(tens)    </script></body>  </html>
Output:
2. Using NPM/ yarn: We can either use NPM or Yarn to install tensorflow.js.
yarn add @tensorflow/tfjs
or
npm install @tensorflow/tfjs
Node.js Setup:
Option 1: Install TensorFlow.js with native C++ bindings.
yarn add @tensorflow/tfjs-node
or
npm install @tensorflow/tfjs-node
Option 2: (Linux Only) If your system has a NVIDIA® GPU with CUDA support, use the GPU package even for higher performance.
yarn add @tensorflow/tfjs-node-gpu
or
npm install @tensorflow/tfjs-node-gpu
Option 3: Install the pure JavaScript version. This is the slowest option performance-wise.
yarn add @tensorflow/tfjs
or
npm install @tensorflow/tfjs
Tensorflow.js
JavaScript
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Remove elements from a JavaScript Array
Convert a string to an integer in JavaScript
Difference between var, let and const keywords in JavaScript
Differences between Functional Components and Class Components in React
How to calculate the number of days between two dates in javascript?
Remove elements from a JavaScript Array
Installation of Node.js on Linux
Convert a string to an integer in JavaScript
How to fetch data from an API in ReactJS ?
How to insert spaces/tabs in text using HTML/CSS?