def get_central_values(flat_input, input_size, center_size, palette_size):
  """
  Takes a flat array which is assumed to represent input_size by input_size by
  palette_size data, and returns a flat array that represents the center_size
  by center_size central values of the original array.
  """
  lc = input_size//2 - center_size//2
  rs = flat_input.reshape((input_size, input_size, palette_size))
  sel = rs[lc:lc+center_size, lc:lc+center_size, :]
  return sel.reshape([-1])