(
    restricted_classes_per_split, classes_per_split)
Check the validity of the given restricted_classes_per_split.

  Args:
    restricted_classes_per_split: A dict mapping Split enums to the number of
      classes to restrict to for that split.
    classes_per_split: A dict mapping Split enums to the total available number
      of classes for that split.

  Raises:
    ValueError: if restricted_classes_per_split is invalid.
Check the validity of the given restricted_classes_per_split.
Check the validity of the given restricted_classes_per_split .
def _check_validity_of_restricted_classes_per_split(
    restricted_classes_per_split, classes_per_split):
  """Check the validity of the given restricted_classes_per_split.

  Args:
    restricted_classes_per_split: A dict mapping Split enums to the number of
      classes to restrict to for that split.
    classes_per_split: A dict mapping Split enums to the total available number
      of classes for that split.

  Raises:
    ValueError: if restricted_classes_per_split is invalid.
  """
  for split_enum, num_classes in restricted_classes_per_split.items():
    if split_enum not in [
        learning_spec.Split.TRAIN, learning_spec.Split.VALID,
        learning_spec.Split.TEST
    ]:
      raise ValueError('Invalid key {} in restricted_classes_per_split.'
                       'Valid keys are: learning_spec.Split.TRAIN, '
                       'learning_spec.Split.VALID, and '
                       'learning_spec.Split.TEST'.format(split_enum))
    if num_classes > classes_per_split[split_enum]:
      raise ValueError('restricted_classes_per_split can not specify a '
                       'number of classes greater than the total available '
                       'for that split. Specified {} for split {} but have '
                       'only {} available for that split.'.format(
                           num_classes, split_enum,
                           classes_per_split[split_enum]))
def _check_validity_of_restricted_classes_per_split ( restricted_classes_per_split , classes_per_split ) : for split_enum , num_classes in restricted_classes_per_split . items ( ) : if split_enum not in [ learning_spec . Split . TRAIN , learning_spec . Split . VALID , learning_spec . Split . TEST ] : raise ValueError ( 'Invalid key {} in restricted_classes_per_split.' 'Valid keys are: learning_spec.Split.TRAIN, ' 'learning_spec.Split.VALID, and ' 'learning_spec.Split.TEST' . format ( split_enum ) ) if num_classes > classes_per_split [ split_enum ] : raise ValueError ( 'restricted_classes_per_split can not specify a ' 'number of classes greater than the total available ' 'for that split. Specified {} for split {} but have ' 'only {} available for that split.' . format ( num_classes , split_enum , classes_per_split [ split_enum ] ) )