def generate_instance_tuples(num_per_class_list):
  """Generate list of tuples [(class_index, instance_index)...]."""
  num_classes = len(num_per_class_list)
  class_and_instance_indices = []
  for i in range(num_classes):
    num_instances = num_per_class_list[i]
    class_and_instance_indices.extend([(i, j) for j in range(num_instances)])

  return class_and_instance_indices