def visualize_data_examples(self, visualize_per_split=0):
    """Visualize data examples. Sample examples from each split if not any."""
    if not self._examples_to_visualize and visualize_per_split == 0:
      logging.info("No examples to visualize.")
    save_dirs = []
    if not self._examples_to_visualize and visualize_per_split > 0:
      for split, data_pairs in self._data_pairs.items():
        num_to_sample = min(len(data_pairs), visualize_per_split)
        examples = random.sample(data_pairs, k=num_to_sample)
        for data_example in examples:
          save_dir = self.visualize_data_example(
              data_example, parent_save_dir=split)
          save_dirs.append(save_dir)
    else:
      for data_example in self._examples_to_visualize:
        save_dir = self.visualize_data_example(data_example)
        save_dirs.append(save_dir)
    return save_dirs
Visualize data examples. Sample examples from each split if not any.
language/gscan/data/dataset.py