def split_data(x, t, val_rate, test_rate):
  """Splits data into training, validation, and testing data.

  Args:
    x: Data to split.
    t: Label to split.
    val_rate: What percentage of data to use as a validation set.
    test_rate: What percentage of data to use as a testing set.

  Returns:
    train_x: Training inputs.
    train_t: Training labels.
    val_x: Validation inputs.
    val_t: Validation labels.
    test_x: Testing inputs.
    test_t: Testing labels.
  """

  n = x.shape[0]
  train_x = x[:int(n * (1 - val_rate - test_rate))]
  train_t = t[:int(n * (1 - val_rate - test_rate))]
  val_x= x[int(n * (1 - val_rate -  test_rate)):int(n * (1 - test_rate))]
  val_t = t[int(n * (1 - val_rate -  test_rate)):int(n * (1 - test_rate))]
  test_x = x[int(n * (1 - test_rate)):]
  test_t = t[int(n * (1 - test_rate)):]
  return train_x, train_t, val_x, val_t, test_x, test_t