code: def switch_dropout(dropout_keep_prob, mode=None):
      """Turns off dropout when not in training mode.
  
      Args:
          dropout_keep_prob: Dropout keep probability in training mode
          mode (optional): A Tensor taking values of
              :tf_main:`tf.estimator.ModeKeys <estimator/ModeKeys>`.
              Dropout is activated if :attr:`mode` is `TRAIN`.
              If `None`, the mode is inferred from
              :func:`texar.tf.global_mode`.
  
      Returns:
          A unit Tensor that equals the dropout keep probability in `TRAIN` mode,
          and `1.0` in other modes.
      """
      return 1.0 - (1.0 - dropout_keep_prob) * tf.cast(
          is_train_mode(mode), tf.float32
      )
  
file_path: texar/texar/tf/utils/mode.py
imports: import tensorflow
  from texar.tf import context
label_desc: Use image node_id 8 for calling a global function with example usage: switch_dropout(dropout_keep_prob, mode) and returns: unknown