(x, rank=None)
Returns the dimensions of a Tensor as list of integers or scale tensors.

    Args:
      x: N-d Tensor;
      rank: Rank of the Tensor. If None, will try to guess it.
    Returns:
      A list of `[d1, d2, ..., dN]` corresponding to the dimensions of the
        input tensor.  Dimensions that are statically known are python integers,
        otherwise they are integer scalar tensors.
Returns the dimensions of a Tensor as list of integers or scale tensors.
Returns the dimensions of a Tensor as list of integers or scale tensors .
def get_shape(x, rank=None):
    """Returns the dimensions of a Tensor as list of integers or scale tensors.

    Args:
      x: N-d Tensor;
      rank: Rank of the Tensor. If None, will try to guess it.
    Returns:
      A list of `[d1, d2, ..., dN]` corresponding to the dimensions of the
        input tensor.  Dimensions that are statically known are python integers,
        otherwise they are integer scalar tensors.
    """
    if x.get_shape().is_fully_defined():
        return x.get_shape().as_list()
    else:
        static_shape = x.get_shape()
        if rank is None:
            static_shape = static_shape.as_list()
            rank = len(static_shape)
        else:
            static_shape = x.get_shape().with_rank(rank).as_list()
        dynamic_shape = tf.unstack(tf.shape(x), rank)
        return [s if s is not None else d
                for s, d in zip(static_shape, dynamic_shape)]
def get_shape ( x , rank = None ) : if x . get_shape ( ) . is_fully_defined ( ) : return x . get_shape ( ) . as_list ( ) else : static_shape = x . get_shape ( ) if rank is None : static_shape = static_shape . as_list ( ) rank = len ( static_shape ) else : static_shape = x . get_shape ( ) . with_rank ( rank ) . as_list ( ) dynamic_shape = tf . unstack ( tf . shape ( x ) , rank ) return [ s if s is not None else d for s , d in zip ( static_shape , dynamic_shape ) ]