code: def is_training(is_training=False, session=None):
      """is_training.
  
      Set the graph training mode.
  
      This is meant to be used to control ops that have different output at
      training and testing time., such as dropout or batch normalization,
  
      Examples:
          ```
          >> # Retrieve variable responsible for managing training mode
          >> training_mode = tflearn.get_training_mode()
          >> # Define a conditional op
          >> my_conditional_op = tf.cond(training_mode, if_yes_op, if_no_op)
          >> # Set training mode to True
          >> tflearn.is_training(True)
          >> session.run(my_conditional_op)
          if_yes_op
          >> # Set training mode to False
          >> tflearn.is_training(False)
          >> session.run(my_conditional_op)
          if_no_op
          ```
  
      Returns:
          A `bool`, True if training, False else.
  
      """
      if not session:
          session = tf.get_default_session()
      init_training_mode()
      if is_training:
          tf.get_collection("is_training_ops")[0].eval(session=session)
      else:
          tf.get_collection("is_training_ops")[1].eval(session=session)
  
imports: from __future__ import division, print_function, absolute_import
  import tensorflow.compat.v1
  from .variables import variable
label_desc: Use image node_id 2 for calling a global function with example usage: is_training(is_training, session) without return types