def _all_dims(x, default_dims=None):
  """Returns a list of dims in x or default_dims if the rank is unknown."""
  if x.get_shape().ndims is not None:
    return list(xrange(x.get_shape().ndims))
  else:
    return default_dims
Returns a list of dims in x or default_dims if the rank is unknown.