Python - tensorflow.executing_eagerly() Last Updated : 07 Mar, 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. executing_eagerly() is used check if eager execution is enabled or disabled in current thread. By default eager execution is enabled so in most cases it will return true. This will return false in following cases: If it is executing inside tensorflow.function and tf.init_scope or tf.config.experimental_run_functions_eagerly(True) is not called previously.Executing inside a transformation function for tensorflow.dataset.tensorflow.compat.v1.disable_eager_execution() is called. Syntax: tensorflow.executing_eagerly() Parameters: This doesn't accept any parameters. Returns: It returns true if eager execution is enabled otherwise it will return false. Example 1: Python3 # Importing the library import tensorflow as tf # Checking eager execution res = tf.executing_eagerly() # Printing the result print('res: ', res) Output: res: True Example 2: This example checks eager execution for tensorflow.function with and without init_scope. Python3 # Importing the library import tensorflow as tf @tf.function def gfg(): with tf.init_scope(): # Checking eager execution inside init_scope res = tf.executing_eagerly() print("res 1:", res) # Checking eager execution outside init_scope res = tf.executing_eagerly() print("res 2:", res) gfg() Output: res 1: True res 2: False Comment More infoAdvertise with us Next Article Python - tensorflow.executing_eagerly() aman neekhara Follow Improve Article Tags : Python Tensorflow Python-Tensorflow Practice Tags : python Similar Reads Python - tensorflow.eye() TensorFlow is open-source Python library designed by Google to develop Machine Learning models and deep learning  neural networks. tensorflow.eye() is used to generate identity matrix. Syntax: tensorflow.eye( num_rows, num_columns, batch_shape, dtype, name) Parameters: num_rows: It is int32 scalar 2 min read Python - tensorflow.gather_nd() TensorFlow is open-source Python library designed by Google to develop Machine Learning models and deep learning  neural networks. gather_nd() is used to gather the slice from input tensor based on the indices provided. Syntax: tensorflow.gather_nd( params, indices, batch_dims, name) Parameters: pa 2 min read Python - tensorflow.gather() TensorFlow is open-source Python library designed by Google to develop Machine Learning models and deep learning  neural networks. gather() is used to slice the input tensor based on the indices provided. Syntax: tensorflow.gather( params, indices, validate_indices, axis, batch_dims, name) Paramete 2 min read Python - tensorflow.cond() TensorFlow is open-source Python library designed by Google to develop Machine Learning models and deep learning  neural networks. cond() return true_fn() if the predicate pred is true otherwise it returns false_fn(). Syntax: tensorflow.cond( pred, true_fn, false_fn, name ) Parameters: pred: It is a 1 min read Python - tensorflow.identity_n() TensorFlow is open-source Python library designed by Google to develop Machine Learning models and deep learning  neural networks. identity_n() is used get a list of Tensor with same shape and content as input Tensor. Syntax: tensorflow.identity_n( input, name) Parameters: input:  It is a Tensor.na 2 min read Like