Python - tensorflow.math.is_nan() Last Updated : 19 Apr, 2023 Comments Improve Suggest changes Like Article Like Report TensorFlow is open-source Python library designed by Google to develop Machine Learning models and deep learning neural networks. is_nan() returns true if element is NaN otherwise it returns false. Syntax: tensorflow.math.is_NaN( x, name) Parameters: x: It is a tensor. Allowed dtypes are bfloat16, half, float32, float64.name(optional): It defines the name of the operation Returns: It returns a tensor of dtype bool. Example 1: Python3 # importing the library import tensorflow as tf import numpy as np # Initializing the input tensor a = tf.constant([7, 8, 13, 11, np.inf], dtype = tf.float64) # Printing the input tensor print('a: ', a) # Calculating the result res = tf.math.is_nan(a) # Printing the result print('Result: ', res) Output: a: tf.Tensor([ 7. 8. 13. 11. inf], shape=(5, ), dtype=float64) Result: tf.Tensor([False False False False False], shape=(5, ), dtype=bool) Example 2: This example uses numpy nan. Python3 # Importing the library import tensorflow as tf import numpy as np # Initializing the input tensor a = tf.constant([7, 8, 13, 11, np.nan], dtype = tf.float64) # Printing the input tensor print('a: ', a) # Calculating the result res = tf.math.is_nan(a) # Printing the result print('Result: ', res) Output: a: tf.Tensor([ 7. 8. 13. 11. nan], shape=(5, ), dtype=float64) Result: tf.Tensor([False False False False True], shape=(5, ), dtype=bool) Comment More infoAdvertise with us Next Article Python - tensorflow.math.is_nan() aman neekhara Follow Improve Article Tags : Machine Learning AI-ML-DS With Python Practice Tags : Machine Learning Similar Reads Python - tensorflow.math.divide_no_nan() TensorFlow is open-source Python library designed by Google to develop Machine Learning models and deep learning  neural networks. divide_no_nan() is used to compute element wise safe division of x by y i.e it returns 0 if y is zero Syntax: tensorflow.math.divide_no_nan( x, y, name) Parameters: x: 2 min read Python - tensorflow.math.less() TensorFlow is open-source Python library designed by Google to develop Machine Learning models and deep learning  neural networks. less() is used to find element wise truth value of x<y. It supports broadcasting Syntax: tensorflow.math.less( x, y, name) Parameters: x: It is a tensor. Allowed dty 2 min read Python - tensorflow.math.asin() TensorFlow is open-source python library designed by Google to develop Machine Learning models and deep learning  neural networks. asin() is used to find element wise asin of x. Syntax: tf.math.asin(x, name) Parameters: x: It's the input tensor. Allowed dtype for this tensor are bfloat16, half, flo 1 min read Python - tensorflow.math.ceil() TensorFlow is open-source Python library designed by Google to develop Machine Learning models and deep learning  neural networks. ceil() is used to find the element wise ceil value of the input. Syntax: tensorflow.math.ceil( x, name) Parameters: x: It's a tensor and allowed dtype for this tensor a 2 min read Python - tensorflow.math.pow() TensorFlow is open-source python library designed by Google to develop Machine Learning models and deep learning  neural networks. pow() is used to find element wise x^y. Syntax: tf.math.pow(x, y, name) Parameter: x: It's the input tensor. Allowed dtype for this tensor are float16, float32, float64, 2 min read Python - tensorflow.math.ndtri() TensorFlow is open-source python library designed by Google to develop Machine Learning models and deep learning  neural networks. ndtri() is used to find quantile of Standard Normal. Syntax: tf.math.ndtri(x, name) Parameter: x: It's the input tensor. Allowed dtype for this tensor are float or doubl 1 min read Python - tensorflow.math.negative() TensorFlow is open-source python library designed by Google to develop Machine Learning models and deep learning  neural networks. negative() is used to find element wise negative value of x. Syntax: tf.math.negative(x, name) Parameter: x: It's the input tensor. Allowed dtype for this tensor are bfl 2 min read Python - tensorflow.math.is_finite() TensorFlow is open-source Python library designed by Google to develop Machine Learning models and deep learning  neural networks. is_finite() is used to check element wise finiteness of x. Syntax: tensorflow.math.is_finite( x, name) Parameters: x: It is a tensor. Allowed dtypes are bfloat16, half, 2 min read Python - tensorflow.math.not_equal() TensorFlow is open-source Python library designed by Google to develop Machine Learning models and deep learning  neural networks. not_equal() is used to find element wise truth value of x!=y. It supports broadcasting Syntax: tensorflow.math.not_equal( x, y, name) Parameters: x: It is a tensor. All 2 min read Like