parameters: (x, alt, training=None)
return_statement: return x
docstring: Selects `x` in train phase, and `alt` otherwise.
  
    Note that `alt` should have the *same shape* as `x`.
  
    Arguments:
        x: What to return in train phase
            (tensor or callable that returns a tensor).
        alt: What to return otherwise
            (tensor or callable that returns a tensor).
        training: Optional scalar tensor
            (or Python boolean, or Python integer)
            specifying the learning phase.
  
    Returns:
        Either `x` or `alt` based on the `training` flag.
        the `training` flag defaults to `K.learning_phase()`.
docstring_summary: Selects `x` in train phase, and `alt` otherwise.
docstring_tokens: Selects x in train phase and alt otherwise .
function: def in_train_phase(x, alt, training=None):
    """Selects `x` in train phase, and `alt` otherwise.
  
    Note that `alt` should have the *same shape* as `x`.
  
    Arguments:
        x: What to return in train phase
            (tensor or callable that returns a tensor).
        alt: What to return otherwise
            (tensor or callable that returns a tensor).
        training: Optional scalar tensor
            (or Python boolean, or Python integer)
            specifying the learning phase.
  
    Returns:
        Either `x` or `alt` based on the `training` flag.
        the `training` flag defaults to `K.learning_phase()`.
    """
    if training is None:
      training = learning_phase()
      uses_learning_phase = True
    else:
      uses_learning_phase = False
  
    if training is 1 or training is True:
      if callable(x):
        return x()
      else:
        return x
  
    elif training is 0 or training is False:
      if callable(alt):
        return alt()
      else:
        return alt
  
    # else: assume learning phase is a placeholder tensor.
    x = switch(training, x, alt)
    if uses_learning_phase:
      x._uses_learning_phase = True
    return x
function_tokens: def in_train_phase ( x , alt , training = None ) : if training is None : training = learning_phase ( ) uses_learning_phase = True else : uses_learning_phase = False if training is 1 or training is True : if callable ( x ) : return x ( ) else : return x elif training is 0 or training is False : if callable ( alt ) : return alt ( ) else : return alt # else: assume learning phase is a placeholder tensor. x = switch ( training , x , alt ) if uses_learning_phase : x . _uses_learning_phase = True return x