code: def sample_generator(loader):
      def __reader__():
          for indx, data in enumerate(loader):
              images = np.array(data[0])
              yield images
  
      return __reader__
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  import sys
  import yaml
  import paddle
  import paddle.distributed
  from ppocr.data import build_dataloader, set_signal_handlers
  from ppocr.modeling.architectures import build_model
  from ppocr.losses import build_loss
  from ppocr.optimizer import build_optimizer
  from ppocr.postprocess import build_post_process
  from ppocr.metrics import build_metric
  from ppocr.utils.save_load import load_model
  import tools.program
  import paddleslim
  from paddleslim.dygraph.quant import QAT
  import numpy
label_desc: Use image node_id 1 for calling a global function with example usage: sample_generator(loader) and returns: __reader__