parameters: (input_tensor, output_rank, column_name=None)
return_statement: return layers._inner_flatten(input_tensor, output_rank)
docstring: Reshaping logic for dense, numeric `Tensors`.
  
    Follows the following rules:
      1. If `output_rank > input_rank + 1` raise a `ValueError`.
      2. If `output_rank == input_rank + 1`, expand `input_tensor` by one
         dimension and return
      3. If `output_rank == input_rank`, return `input_tensor`.
      4. If `output_rank < input_rank`, flatten the inner dimensions of
         `input_tensor` and return a `Tensor` with `output_rank`
  
    Args:
      input_tensor: a dense `Tensor` to be reshaped.
      output_rank: the desired rank of the reshaped `Tensor`.
      column_name: (optional) the name of the associated column. Used for error
        messages.
    Returns:
      A `Tensor` with the same entries as `input_tensor` and rank `output_rank`.
    Raises:
      ValueError: if `output_rank > input_rank + 1`.
docstring_summary: Reshaping logic for dense, numeric `Tensors`.
docstring_tokens: Reshaping logic for dense numeric Tensors .
function: def _reshape_real_valued_tensor(input_tensor, output_rank, column_name=None):
    """Reshaping logic for dense, numeric `Tensors`.
  
    Follows the following rules:
      1. If `output_rank > input_rank + 1` raise a `ValueError`.
      2. If `output_rank == input_rank + 1`, expand `input_tensor` by one
         dimension and return
      3. If `output_rank == input_rank`, return `input_tensor`.
      4. If `output_rank < input_rank`, flatten the inner dimensions of
         `input_tensor` and return a `Tensor` with `output_rank`
  
    Args:
      input_tensor: a dense `Tensor` to be reshaped.
      output_rank: the desired rank of the reshaped `Tensor`.
      column_name: (optional) the name of the associated column. Used for error
        messages.
    Returns:
      A `Tensor` with the same entries as `input_tensor` and rank `output_rank`.
    Raises:
      ValueError: if `output_rank > input_rank + 1`.
    """
    input_rank = input_tensor.get_shape().ndims
    if input_rank is not None:
      if output_rank > input_rank + 1:
        error_string = ("Rank of input Tensor ({}) should be the same as "
                        "output_rank ({}). For example, sequence data should "
                        "typically be 3 dimensional (rank 3) while non-sequence "
                        "data is typically 2 dimensional (rank 2).".format(
                            input_rank, output_rank))
        if column_name is not None:
          error_string = ("Error while processing column {}.".format(column_name)
                          + error_string)
        raise ValueError(error_string)
      if output_rank == input_rank + 1:
        logging.warning(
            "Rank of input Tensor ({}) should be the same as output_rank ({}) "
            "for column. Will attempt to expand dims. It is highly recommended "
            "that you resize your input, as this behavior may change.".format(
                input_rank, output_rank))
        return array_ops.expand_dims(input_tensor, -1, name="expand_dims")
      if output_rank == input_rank:
        return input_tensor
    # Here, either `input_rank` is unknown or it is greater than `output_rank`.
    return layers._inner_flatten(input_tensor, output_rank)
function_tokens: def _reshape_real_valued_tensor ( input_tensor , output_rank , column_name = None ) : input_rank = input_tensor . get_shape ( ) . ndims if input_rank is not None : if output_rank > input_rank + 1 : error_string = ( "Rank of input Tensor ({}) should be the same as " "output_rank ({}). For example, sequence data should " "typically be 3 dimensional (rank 3) while non-sequence " "data is typically 2 dimensional (rank 2)." . format ( input_rank , output_rank ) ) if column_name is not None : error_string = ( "Error while processing column {}." . format ( column_name ) + error_string ) raise ValueError ( error_string ) if output_rank == input_rank + 1 : logging . warning ( "Rank of input Tensor ({}) should be the same as output_rank ({}) " "for column. Will attempt to expand dims. It is highly recommended " "that you resize your input, as this behavior may change." . format ( input_rank , output_rank ) ) return array_ops . expand_dims ( input_tensor , - 1 , name = "expand_dims" ) if output_rank == input_rank : return input_tensor # Here, either `input_rank` is unknown or it is greater than `output_rank`. return layers . _inner_flatten ( input_tensor , output_rank )