parameters: (x)
return_statement: return control_flow_ops.cond(
        has_rank_zero, lambda: array_ops.constant([1]), lambda: dynamic_shape)
docstring: Gets the dimension sizes of a tensor `x`.
  
    If a size can be determined statically it is returned as an integer,
    otherwise as a tensor.
  
    If `x` is a scalar it is treated as rank 1 size 1.
  
    Args:
      x: A `Tensor`.
  
    Returns:
      Dimension sizes.
docstring_summary: Gets the dimension sizes of a tensor `x`.
docstring_tokens: Gets the dimension sizes of a tensor x .
function: def _dimension_sizes(x):
    """Gets the dimension sizes of a tensor `x`.
  
    If a size can be determined statically it is returned as an integer,
    otherwise as a tensor.
  
    If `x` is a scalar it is treated as rank 1 size 1.
  
    Args:
      x: A `Tensor`.
  
    Returns:
      Dimension sizes.
    """
    dynamic_shape = array_ops.shape(x)
    rank = x.get_shape().rank
    rank_is_known = rank is not None
    if rank_is_known and rank == 0:
      return (1,)
    if rank_is_known and rank > 0:
      static_shape = x.get_shape().as_list()
      sizes = [
          int(size) if size is not None else dynamic_shape[i]
          for i, size in enumerate(static_shape)
      ]
      return sizes
    has_rank_zero = math_ops.equal(array_ops.rank(x), 0)
    return control_flow_ops.cond(
        has_rank_zero, lambda: array_ops.constant([1]), lambda: dynamic_shape)
function_tokens: def _dimension_sizes ( x ) : dynamic_shape = array_ops . shape ( x ) rank = x . get_shape ( ) . rank rank_is_known = rank is not None if rank_is_known and rank == 0 : return ( 1 , ) if rank_is_known and rank > 0 : static_shape = x . get_shape ( ) . as_list ( ) sizes = [ int ( size ) if size is not None else dynamic_shape [ i ] for i , size in enumerate ( static_shape ) ] return sizes has_rank_zero = math_ops . equal ( array_ops . rank ( x ) , 0 ) return control_flow_ops . cond ( has_rank_zero , lambda : array_ops . constant ( [ 1 ] ) , lambda : dynamic_shape )