Tensorflow.js tf.softplus() Function Last Updated : 18 May, 2021 Summarize Comments Improve Suggest changes Share Like Article Like Report Tensorflow.js is an open-source library that is developed by Google for running machine learning models as well as deep learning neural networks in the browser or node environment. The .softplus() function is used to find softplus of the stated input tensor i.e. log(exp(x) + 1) and is done element wise. Syntax : tf.softplus(x) Parameters: x: It is the stated tensor input, and it can be of type tf.Tensor, TypedArray, or Array. Return Value: It returns the tf.Tensor object. Example 1: JavaScript // Importing the tensorflow.js library import * as tf from "@tensorflow/tfjs" // Defining tensor input elements const y = tf.tensor1d([11, 17, 0, NaN, -41]); // Calling softplus() method and // Printing output y.softplus().print(); Output: Tensor [11.0000162, 17, 0.6931472, NaN, 0] Example 2: JavaScript // Importing the tensorflow.js library import * as tf from "@tensorflow/tfjs" // Defining tensor input var val = [1.5, .4, .23, null, 'a']; // Calling tensor1d method const y = tf.tensor1d(val); // Calling softplus() method var res = tf.softplus(y) // Printing output res.print(); Output: Tensor [1.7014132, 0.9130152, 0.8147451, 0.6931472, NaN] Reference: https://js.tensorflow.org/api/latest/#softplus Comment More infoAdvertise with us Next Article Tensorflow.js tf.prelu() Function N nidhi1352singh Follow Improve Article Tags : JavaScript Web Technologies Tensorflow.js Similar Reads Tensorflow.js tf.step() Function 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. The tf.step() function is used to return the step of the input tensor's elements i.e. it returns 1 if the element is greater than 0 el 1 min read Tensorflow.js tf.prelu() Function Tensorflow.js is an open-source library that is developed by Google for running machine learning models as well as deep learning neural networks in the browser or node environment. The .prelu() function is used to find leaky rectified linear of the stated tensor input along with parametric alphas an 2 min read Tensorflow.js tf.ones() Function Tensorflow.js is an open-source library for running machine learning models and deep learning neural networks in the browser or node environment. The tf.ones() function is used to create a new tensor where all elements are set to 1. Syntax: tf.ones(shape, dtype, name) Parameters: shape: It takes the 2 min read Tensorflow.js tf.pad() Function 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. 2 min read Tensorflow.js tf.stack() Function 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 helps developers to develop ML models in JavaScript, and use ML directly in the browser or in Node.js. The tf.stack() function is u 2 min read Tensorflow.js tf.model() Function Tensorflow.js is an open-source library that is developed by Google for running machine learning models as well as deep learning neural networks in the browser or node environment. The tf.model() function is used to create a model which contains layers and layers that are provided in form of input a 2 min read Like