import collections


def _get_sliced_variables(var_list):
  """Separates the sliced (partitioned) and unsliced variables in var_list.

  Args:
    var_list: a list of variables.

  Returns:
    A list of unsliced variables in var_list, and a dict mapping names to parts
    for the sliced variables in var_list.
  """
  unsliced_variables = []
  sliced_variables = collections.defaultdict(lambda: [])
  for var in var_list:
    if var._save_slice_info:
      sliced_variables[var._save_slice_info.full_name].append(var)
    else:
      unsliced_variables.append(var)
  return unsliced_variables, sliced_variables