parameters: (x, gamma, beta, reduction_axes, epsilon=1e-3)
return_statement: return normed, mean, var
docstring: Computes mean and std for batch then apply batch_normalization on batch.
  
    Arguments:
        x: Input tensor or variable.
        gamma: Tensor by which to scale the input.
        beta: Tensor with which to center the input.
        reduction_axes: iterable of integers,
            axes over which to normalize.
        epsilon: Fuzz factor.
  
    Returns:
        A tuple length of 3, `(normalized_tensor, mean, variance)`.
docstring_summary: Computes mean and std for batch then apply batch_normalization on batch.
docstring_tokens: Computes mean and std for batch then apply batch_normalization on batch .
function: def normalize_batch_in_training(x, gamma, beta, reduction_axes, epsilon=1e-3):
    """Computes mean and std for batch then apply batch_normalization on batch.
  
    Arguments:
        x: Input tensor or variable.
        gamma: Tensor by which to scale the input.
        beta: Tensor with which to center the input.
        reduction_axes: iterable of integers,
            axes over which to normalize.
        epsilon: Fuzz factor.
  
    Returns:
        A tuple length of 3, `(normalized_tensor, mean, variance)`.
    """
    mean, var = nn.moments(
        x, reduction_axes, shift=None, name=None, keep_dims=False)
    if sorted(reduction_axes) == list(range(ndim(x)))[:-1]:
      normed = nn.batch_normalization(x, mean, var, beta, gamma, epsilon)
    else:
      # need broadcasting
      target_shape = []
      for axis in range(ndim(x)):
        if axis in reduction_axes:
          target_shape.append(1)
        else:
          target_shape.append(array_ops.shape(x)[axis])
      target_shape = array_ops.stack(target_shape)
  
      broadcast_mean = array_ops.reshape(mean, target_shape)
      broadcast_var = array_ops.reshape(var, target_shape)
      if gamma is None:
        broadcast_gamma = None
      else:
        broadcast_gamma = array_ops.reshape(gamma, target_shape)
      if beta is None:
        broadcast_beta = None
      else:
        broadcast_beta = array_ops.reshape(beta, target_shape)
      normed = nn.batch_normalization(x, broadcast_mean, broadcast_var,
                                      broadcast_beta, broadcast_gamma, epsilon)
    return normed, mean, var
function_tokens: def normalize_batch_in_training ( x , gamma , beta , reduction_axes , epsilon = 1e-3 ) : mean , var = nn . moments ( x , reduction_axes , shift = None , name = None , keep_dims = False ) if sorted ( reduction_axes ) == list ( range ( ndim ( x ) ) ) [ : - 1 ] : normed = nn . batch_normalization ( x , mean , var , beta , gamma , epsilon ) else : # need broadcasting target_shape = [ ] for axis in range ( ndim ( x ) ) : if axis in reduction_axes : target_shape . append ( 1 ) else : target_shape . append ( array_ops . shape ( x ) [ axis ] ) target_shape = array_ops . stack ( target_shape ) broadcast_mean = array_ops . reshape ( mean , target_shape ) broadcast_var = array_ops . reshape ( var , target_shape ) if gamma is None : broadcast_gamma = None else : broadcast_gamma = array_ops . reshape ( gamma , target_shape ) if beta is None : broadcast_beta = None else : broadcast_beta = array_ops . reshape ( beta , target_shape ) normed = nn . batch_normalization ( x , broadcast_mean , broadcast_var , broadcast_beta , broadcast_gamma , epsilon ) return normed , mean , var