(
      self,
      md_version,
      meta_split,
      relative_label = None)
Returns the start and stop indices for a class or split.

    Args:
      md_version: Meta-Dataset version in {'v1', 'v2'}.
      meta_split: meta-split (case-insensitive) in {'train', 'valid', 'test'}.
      relative_label: label, relative to the meta-split. If None, returns the
        start and stop indices for the entire split.

    Returns:
      (start, stop) indices for the class/split.

    Raises:
      ValueError, if the source does not provide `meta_split` in `md_version`.
Returns the start and stop indices for a class or split.
Returns the start and stop indices for a class or split .
def get_start_stop(
      self,
      md_version,
      meta_split,
      relative_label = None):
    """Returns the start and stop indices for a class or split.

    Args:
      md_version: Meta-Dataset version in {'v1', 'v2'}.
      meta_split: meta-split (case-insensitive) in {'train', 'valid', 'test'}.
      relative_label: label, relative to the meta-split. If None, returns the
        start and stop indices for the entire split.

    Returns:
      (start, stop) indices for the class/split.

    Raises:
      ValueError, if the source does not provide `meta_split` in `md_version`.
    """
    full_ways = relative_label is None
    slice_dict = self.info.metadata['meta_split_slices' if full_ways else
                                    'relative_class_slices']

    if md_version not in slice_dict:
      raise ValueError(f'source {self.builder_config.name} '
                       f'not present in version {md_version}')

    slice_dict = slice_dict[md_version]

    meta_split = meta_split.lower()
    if not slice_dict[meta_split]:
      raise ValueError(f'source {self.builder_config.name} does not offer a '
                       f'{meta_split} split in version {md_version}')

    if full_ways:
      return slice_dict[meta_split]
    else:
      # `self.info.metadata` is read from a `metadata.json` file stored on disk
      # alongside the tfrecord files. In JSON, keys are always of type str, so
      # we cast them to int before indexing with `relative_label`.
      #
      # We cast the keys to int instead of casting `relative_label` to str,
      # because in the event that the builder's data path is incorrect the
      # metadata will be created on-the-fly and the slice keys will be of type
      # int, and this block should be robust to that to avoid a cryptic
      # exception being raised.
      slices = {int(k): v for k, v in slice_dict[meta_split].items()}
      return slices[relative_label]
def get_start_stop ( self , md_version , meta_split , relative_label = None ) : full_ways = relative_label is None slice_dict = self . info . metadata [ 'meta_split_slices' if full_ways else 'relative_class_slices' ] if md_version not in slice_dict : raise ValueError ( f'source {self.builder_config.name} ' f'not present in version {md_version}' ) slice_dict = slice_dict [ md_version ] meta_split = meta_split . lower ( ) if not slice_dict [ meta_split ] : raise ValueError ( f'source {self.builder_config.name} does not offer a ' f'{meta_split} split in version {md_version}' ) if full_ways : return slice_dict [ meta_split ] else : # `self.info.metadata` is read from a `metadata.json` file stored on disk # alongside the tfrecord files. In JSON, keys are always of type str, so # we cast them to int before indexing with `relative_label`. # # We cast the keys to int instead of casting `relative_label` to str, # because in the event that the builder's data path is incorrect the # metadata will be created on-the-fly and the slice keys will be of type # int, and this block should be robust to that to avoid a cryptic # exception being raised. slices = { int ( k ) : v for k , v in slice_dict [ meta_split ] . items ( ) } return slices [ relative_label ]