from typing import Sequence
import itertools


def _partition_spins(spins: Sequence[int]) -> Sequence[int]:
  """Returns the indices for splitting an array into spin channels."""
  return list(itertools.accumulate(spins))[:-1]