Tensorflow.js tf.step() Function Last Updated : 10 May, 2021 Summarize Comments Improve Suggest changes Share 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. 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 else return alpha, where alpha is the parameter of the function step(). Syntax: tf.step (x, alpha) Parameters: This function accepts two parameters which are illustrated below: x: The specified input tensor.alpha: The gradient for the negative input value. Return Value: It returns the step of the input tensor's elements. Example 1: JavaScript // Importing the tensorflow.js library import * as tf from "@tensorflow/tfjs" // Initializing a tensor of some elements const x = tf.tensor1d([2, 0, -2, -5]); // Calling the .step() function over // the above tensor as its parameter and // for the alpha value .2 x.step(.2).print(); Output: Tensor [1, 0.2, 0.2, 0.2] Example 2: JavaScript // Importing the tensorflow.js library import * as tf from "@tensorflow/tfjs" // Using a tensor of some elements as // the parameter for the .step() function with // alpha value of 6 tf.tensor1d([0, .8, -1, -5.4]).step(6).print(); Output: Tensor [6, 1, 6, 6] Comment More infoAdvertise with us Next Article Tensorflow.js tf.selu() Function K Kanchan_Ray Follow Improve Article Tags : JavaScript Web Technologies Tensorflow.js Similar Reads Tensorflow.js tf.selu() 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 .selu() function is used to find the scaled exponential linear and is done element wise. Syntax: Â tf.selu(x) Where 1 min read Tensorflow.js tf.keep() 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 .keep() function is used to hold a tensor input that is formed within a tf.tidy() method from being spontaneously d 1 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.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.tan() Function Tensorflow.js is an open-source library that is being developed by Google for running machine learning models as well as deep learning neural networks in the browser or node environment. The .tan() function is used to find the tangent of the stated tensor input and is done element wise. Syntax: tf.t 2 min read Tensorflow.js tf.sin() Function Tensorflow.js is an open-source library that is being developed by Google for running machine learning models as well as deep learning neural networks in the browser or node environment. The .sin() function is used to find the sin of the stated tensor input, and it is done element wise. Syntax : Â t 2 min read Like