Tensorflow.js tf.softmax() Function Last Updated : 14 May, 2021 Comments Improve Suggest changes Like Article Like Report Tensorflow.js is an open-source library developed by Google for running machine learning models and deep learning neural networks in the browser or node environment. It also helps the developers to develop ML models in JavaScript language and can use ML directly in the browser or in Node.js. The tf.softmax() function is used to compute the softmax normalized vector given the logits. Syntax: tf.softmax (logits, dim?) Parameters: This function accept two parameters which are illustrated below: Logits: the logits array.dim: The dimension softmax would be performed on. Return Value: It returns tf.Tensor Example 1: JavaScript // Importing the tensorflow.js library import * as tf from "@tensorflow/tfjs" const a = tf.tensor1d([3, 1, 3]); a.softmax().print(); Output: Tensor [0.4683105, 0.0633789, 0.4683105] Example 2: JavaScript // Importing the tensorflow.js library import * as tf from "@tensorflow/tfjs" const a = tf.tensor1d([3, 1, 3]); a.softmax().print(); Output: Tensor [[0.9525742, 0.0474259], [0.7310586, 0.2689414], [0.9933072, 0.0066929]] Reference: https://js.tensorflow.org/api/latest/#softmax Comment More infoAdvertise with us Next Article Interview Preparation For Software Developers D dheerchanana2002 Follow Improve Article Tags : JavaScript Web Technologies Tensorflow.js Similar Reads Interview PreparationInterview Preparation For Software DevelopersMust Coding Questions - Company-wise Must Do Coding Questions - Topic-wiseCompany-wise Practice ProblemsCompany PreparationCompetitive ProgrammingSoftware Design-PatternsCompany-wise Interview ExperienceExperienced - Interview ExperiencesInternship - Interview ExperiencesPractice @GeeksforgeeksProblem of the DayTopic-wise PracticeDifficulty Level - SchoolDifficulty Level - BasicDifficulty Level - EasyDifficulty Level - MediumDifficulty Level - HardLeaderboard !!Explore More...Data StructuresArraysLinked ListStackQueueBinary TreeBinary Search TreeHeapHashingGraphAdvance Data StructuresMatrixStringAll Data StructuresAlgorithmsAnalysis of AlgorithmsSearching AlgorithmsSorting AlgorithmsPattern SearchingGeometric AlgorithmsMathematical AlgorithmsRandomized AlgorithmsGreedy AlgorithmsDynamic ProgrammingDivide & ConquerBacktrackingBranch & BoundAll AlgorithmsProgramming LanguagesCC++JavaPythonC#Go LangSQLPHPScalaPerlKotlinWeb TechnologiesHTMLCSSJavaScriptBootstrapTailwind CSSAngularJSReactJSjQueryNodeJSPHPWeb DesignWeb BrowserFile FormatsComputer Science SubjectsOperating SystemsDBMSComputer NetworkComputer Organization & ArchitectureTOCCompiler DesignDigital Elec. & Logic DesignSoftware EngineeringEngineering MathematicsData Science & MLComplete Data Science CourseData Science TutorialMachine Learning TutorialDeep Learning TutorialNLP TutorialMachine Learning ProjectsData Analysis TutorialTutorial LibraryPython TutorialDjango TutorialPandas TutorialKivy TutorialTkinter TutorialOpenCV TutorialSelenium TutorialGATE CSGATE CS NotesGate CornerPrevious Year GATE PapersLast Minute Notes (LMNs)Important Topic For GATE CSGATE CoursePrevious Year Paper: CS exams Like