Tensorflow.js tf.real() Function Last Updated : 20 May, 2021 Comments Improve Suggest changes Like Article Like Report 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 .real() function is used to find a tensor for the stated tensor input, which is of type float and is the real section of each element that is considered in input as a complex number. Syntax : tf.real( input ) Parameters: input: It is the tensor input, which takes a complex number as an input. Return Value: It returns the real section of a complex or a real tensor input. Example 1: In this example, we are defining an input tensor of float type and then printing the real part of it. For creating an input tensor we are utilizing the .complex() method and in order to print the output we are using the .print() method. JavaScript // Defining input tensor const y = tf.complex([-9.25, 12.25], [6.66, 8.66]); // Calling real() function and // printing the output tf.real(y).print(); Output: Tensor [-9.25, 12.25] Example 2: In this example, we are using null, character, as well as integer type values as tensor input. JavaScript // Defining input tensor const y = tf.complex([null, 'a'], [5, 'r']); // Calling real() function var z = tf.real(y); // Prints output z.print(); Output: Tensor [0, NaN] In the above example, the null value returns zero and the character type value returns NaN. Reference:https://js.tensorflow.org/api/latest/#real Comment More infoAdvertise with us Next Article Tensorflow.js tf.real() Function N nidhi1352singh Follow Improve Article Tags : JavaScript Web Technologies Tensorflow.js Similar Reads Tensorflow.js tf.relu() 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 .relu() function is used to find rectified linear of the stated tensor input i.e. max(x, 0) and is done element wis 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.neg() 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 .neg() function is used to calculate -1 * x i.e. input tensor and is done element wise. Syntax: Â tf.neg(x) 1 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.range() 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. range() is used to create a new tf.Tensor1D filled with the numbers in the range provided with the help of start, stop, step, 2 min read Like