class_docstr: Data Generator.
  
  Used to divide a :class:`matchzoo.DataPack` into batches. This is helpful
  for generating batch-wise features and delaying data preprocessing to the
  `fit` time.
  
  See `tutorials/data_handling.ipynb` for a walkthrough.
  
  :param data_pack: DataPack to generator data from.
  :param mode: One of "point", "pair", and "list". (default: "point")
  :param num_dup: Number of duplications per instance, only effective when
      `mode` is "pair". (default: 1)
  :param num_neg: Number of negative samples per instance, only effective
      when `mode` is "pair". (default: 1)
  :param resample: Either to resample for each epoch, only effective when
      `mode` is "pair". (default: `True`)
  :param batch_size: Batch size. (default: 128)
  :param shuffle: Either to shuffle the samples/instances. (default: `True`)
  :param callbacks: Callbacks. See `matchzoo.data_generator.callbacks` for
      more details.
  
  Examples::
      >>> import numpy as np
      >>> import matchzoo as mz
      >>> np.random.seed(0)
      >>> data_pack = mz.datasets.toy.load_data()
      >>> batch_size = 8
  
  To generate data points:
      >>> point_gen = mz.DataGenerator(
      ...     data_pack=data_pack,
      ...     batch_size=batch_size
      ... )
      >>> len(point_gen)
      13
      >>> x, y = point_gen[0]
      >>> for key, value in sorted(x.items()):
      ...     print(key, str(value)[:30])
      id_left ['Q6' 'Q17' 'Q1' 'Q13' 'Q16' '
      id_right ['D6-6' 'D17-1' 'D1-2' 'D13-3'
      text_left ['how long is the term for fed
      text_right ['See Article I and Article II
  
  To generate data pairs:
      >>> pair_gen = mz.DataGenerator(
      ...     data_pack=data_pack,
      ...     mode='pair',
      ...     num_dup=4,
      ...     num_neg=4,
      ...     batch_size=batch_size,
      ...     shuffle=False
      ... )
      >>> len(pair_gen)
      3
      >>> x, y = pair_gen[0]
      >>> for key, value in sorted(x.items()):
      ...     print(key, str(value)[:30])
      id_left ['Q1' 'Q1' 'Q1' 'Q1' 'Q1' 'Q1'
      id_right ['D1-3' 'D1-4' 'D1-0' 'D1-1' '
      text_left ['how are glacier caves formed
      text_right ['A glacier cave is a cave for
  
  To generate data lists:
      # TODO:
class_docstr_tok: ["Data","Generator",".","Used","to","divide","a",":","class",":","`","matchzoo.DataPack","`","into","batches",".","This","is","helpful","for","generating","batch-wise","features","and","delaying","data","preprocessing","to","the","`","fit","`","time",".","See","`","tutorials\/data_handling.ipynb","`","for","a","walkthrough",".",":","param","data_pack",":","DataPack","to","generator","data","from",".",":","param","mode",":","One","of","``","point","''",",","``","pair","''",",","and","``","list","''",".","(","default",":","``","point","''",")",":","param","num_dup",":","Number","of","duplications","per","instance",",","only","effective","when","`","mode","`","is","``","pair","''",".","(","default",":","1",")",":","param","num_neg",":","Number","of","negative","samples","per","instance",",","only","effective","when","`","mode","`","is","``","pair","''",".","(","default",":","1",")",":","param","resample",":","Either","to","resample","for","each","epoch",",","only","effective","when","`","mode","`","is","``","pair","''",".","(","default",":","`","True","`",")",":","param","batch_size",":","Batch","size",".","(","default",":","128",")",":","param","shuffle",":","Either","to","shuffle","the","samples\/instances",".","(","default",":","`","True","`",")",":","param","callbacks",":","Callbacks",".","See","`","matchzoo.data_generator.callbacks","`","for","more","details",".","Examples",":",":",">",">",">","import","numpy","as","np",">",">",">","import","matchzoo","as","mz",">",">",">","np.random.seed","(","0",")",">",">",">","data_pack","=","mz.datasets.toy.load_data","(",")",">",">",">","batch_size","=","8","To","generate","data","points",":",">",">",">","point_gen","=","mz.DataGenerator","(","...","data_pack=data_pack",",","...","batch_size=batch_size","...",")",">",">",">","len","(","point_gen",")","13",">",">",">","x",",","y","=","point_gen","[","0","]",">",">",">","for","key",",","value","in","sorted","(","x.items","(",")",")",":","...","print","(","key",",","str","(","value",")","[",":30","]",")","id_left","[","'Q6","'","'Q17","'","'Q1","'","'Q13","'","'Q16","'","'","id_right","[","'D6-6","'","'D17-1","'","'D1-2","'","'D13-3'","text_left","[","'how","long","is","the","term","for","fed","text_right","[","'See","Article","I","and","Article","II","To","generate","data","pairs",":",">",">",">","pair_gen","=","mz.DataGenerator","(","...","data_pack=data_pack",",","...","mode='pair","'",",","...","num_dup=4",",","...","num_neg=4",",","...","batch_size=batch_size",",","...","shuffle=False","...",")",">",">",">","len","(","pair_gen",")","3",">",">",">","x",",","y","=","pair_gen","[","0","]",">",">",">","for","key",",","value","in","sorted","(","x.items","(",")",")",":","...","print","(","key",",","str","(","value",")","[",":30","]",")","id_left","[","'Q1","'","'Q1","'","'Q1","'","'Q1","'","'Q1","'","'Q1'","id_right","[","'D1-3","'","'D1-4","'","'D1-0","'","'D1-1","'","'","text_left","[","'how","are","glacier","caves","formed","text_right","[","'","A","glacier","cave","is","a","cave","for","To","generate","data","lists",":","#","TODO",":"]
code: def _handle_callbacks_on_batch_unpacked(self, x, y):
      for callback in self._callbacks:
          callback.on_batch_unpacked(x, y)
  
imports: import math
  import typing
  import keras
  import numpy
  import pandas
  import matchzoo
  from matchzoo.data_generator.callbacks import Callback
label_desc: Use image node_id 7 for calling the DataGenerator obj's underlying member method code with example usage: obj._handle_callbacks_on_batch_unpacked(x, y) without return types