def dims(x):
if isinstance(x, tf.TensorShape):<EOL><INDENT>return x.dims<EOL><DEDENT>r = tf.TensorShape(x).dims<EOL>return None if r is None else list(map(tf.compat.dimension_value, r))<EOL>
Returns a list of dimension sizes, or `None` if `rank` is unknown.

    For more details, see `help(tf.TensorShape.dims)`.

    Args:
      x: object representing a shape; convertible to `tf.TensorShape`.

    Returns:
      shape_as_list: list of sizes or `None` values representing each
        dimensions size if known. A size is `tf.Dimension` if input is a
        `tf.TensorShape` and an `int` otherwise.