Tensorflow.js tf.relu() Function Last Updated : 18 May, 2021 Comments Improve Suggest changes 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 .relu() function is used to find rectified linear of the stated tensor input i.e. max(x, 0) and is done element wise. Syntax : tf.relu(x) Parameters: x: It is the stated tensor input, and it can be of type tf.Tensor, TypedArray, or Array. Moreover, if the stated datatype is of type Boolean then the output datatype will be of type int32. 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, 76, 0, -4, 6]); // Calling relu() method and // Printing output y.relu().print(); Output: Tensor [11, 76, 0, 0, 6] Example 2: JavaScript // Importing the tensorflow.js library import * as tf from "@tensorflow/tfjs" // Defining tensor input var val = [1.5, -5, .22, null, 'a']; // Calling tensor1d method const y = tf.tensor1d(val); // Calling relu() method var res = tf.relu(y) // Printing output res.print(); Output: Tensor [1.5, 0, 0.22, 0, NaN] Reference: https://js.tensorflow.org/api/latest/#relu Comment More infoAdvertise with us Next Article Tensorflow.js tf.relu() Function N nidhi1352singh Follow Improve Article Tags : JavaScript Web Technologies Tensorflow.js Similar Reads 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.relu6() 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 .relu6() function is used to find rectified linear 6 i.e. min(max(x, 0), 6) and is done element wise. Syntax : Â tf 1 min read 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.leakyRelu() Function Tensorflow.js is an open-source library which is being developed by Google for running machine learning models as well as deep learning neural networks in the browser or node environment. The .leakyRelu() function is used to find the leaky rectified linear of the stated tensor input and is done elem 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