code: def constant_value(pred):  # pylint: disable=invalid-name
      """Return the bool value for `pred`, or None if `pred` had a dynamic value.
  
      Args:
        pred: A scalar, either a Python bool or a TensorFlow boolean variable
          or tensor, or the Python integer 1 or 0.
  
      Returns:
        True or False if `pred` has a constant boolean value, None otherwise.
  
      Raises:
        TypeError: If `pred` is not a Variable, Tensor or bool, or Python
          integer 1 or 0.
      """
      if isinstance(pred, tensor.Tensor):
          return tensor_util.constant_value(pred)
      if pred in {0, 1}:  # Accept 1/0 as valid boolean values
          return bool(pred)
      if isinstance(pred, bool):
          return pred
      if isinstance(pred, variables.Variable):
          return None
      raise TypeError(
          "`pred` must be a Tensor, or a Python bool, or 1 or 0. "
          "Found instead: %s" % type(pred)
      )
  
file_path: tensorflow/tensorflow/python/keras/utils/control_flow_util.py
imports: from tensorflow.python.framework import smart_cond
  from tensorflow.python.framework import tensor
  from tensorflow.python.framework import tensor_util
  from tensorflow.python.ops import cond
  from tensorflow.python.ops import variables
label_desc: Use image node_id 7 for calling a global function with example usage: constant_value(pred) and returns: tensor_util, bool, pred, None