class_docstr: DeepMind Mathematics Problem, v1.0, all data.
docstr: Downloads and extracts the dataset and generates examples.
  
  Args:
    data_dir: The base directory where data and vocab files are stored.
    tmp_dir: temp directory to download and extract the dataset.
    dataset_split: split of the data-set.
  
  Yields:
    The data examples.
docstr_tok: ["Downloads","and","extracts","the","dataset","and","generates","examples",".","Args",":","data_dir",":","The","base","directory","where","data","and","vocab","files","are","stored",".","tmp_dir",":","temp","directory","to","download","and","extract","the","dataset",".","dataset_split",":","split","of","the","data-set",".","Yields",":","The","data","examples","."]
code: def generate_samples(self, data_dir, tmp_dir, dataset_split):
      """Downloads and extracts the dataset and generates examples.
  
      Args:
        data_dir: The base directory where data and vocab files are stored.
        tmp_dir: temp directory to download and extract the dataset.
        dataset_split: split of the data-set.
  
      Yields:
        The data examples.
      """
      # Create directories if needed.
      if not tf.gfile.Exists(tmp_dir):
          tf.gfile.MakeDirs(tmp_dir)
      if not tf.gfile.Exists(data_dir):
          tf.gfile.MakeDirs(data_dir)
  
      # Download and extract the data.
      filename = os.path.basename(_URL)
      path = generator_utils.maybe_download(tmp_dir, filename, _URL)
      tarfile.open(path, "r:gz").extractall(tmp_dir)
  
      # Create the list of directories with data files.
      train_dirs = [
          "v1.0/train-easy",
          "v1.0/train-medium",
          "v1.0/train-hard",
      ]
      eval_dirs = ["v1.0/interpolate", "v1.0/extrapolate"]
      dirs = eval_dirs
      if dataset_split == problem.DatasetSplit.TRAIN:
          dirs = train_dirs
      dirs = [os.path.join(tmp_dir, d) for d in dirs]
  
      # Iterate over directories and files generating examples.
      for d in dirs:
          files = tf.gfile.Glob(d + "/*.txt")
          for fname in files:
              # In each text file, the first line is the input, the next the answer,
              # and so on until the end of the file.
              cur_input = None
              with tf.gfile.Open(fname, "rb") as f:
                  for line in f:
                      if cur_input is None:
                          cur_input = line.strip()
                      else:
                          yield {
                              "inputs": cur_input,
                              "targets": line.strip(),
                          }
                          cur_input = None
  
file_path: tensor2tensor/tensor2tensor/data_generators/algorithmic_math_deepmind.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  import tarfile
  from tensor2tensor.data_generators import generator_utils
  from tensor2tensor.data_generators import problem
  from tensor2tensor.data_generators import text_problems
  from tensor2tensor.utils import registry
  import tensorflow.compat.v1
label_desc: Use image node_id 4 for calling the AlgorithmicMathDeepmindAll obj's underlying member method code with example usage: obj.generate_samples(data_dir, tmp_dir, dataset_split) without return types