code: def gen_batches(data, batch_size):
      
      data = np.array(data)
  
      for i in range(0, data.shape[0], batch_size):
          yield data[i:i + batch_size]
docs: Divide input data into batches.
  
      :param data: input data
      :param batch_size: size of each batch
      :return: data divided into batches