docstr: Data generator for fluid.layers.py_reader
          
docstr_tok: ["Data","generator","for","fluid.layers.py_reader"]
code: def learn_data_provider(self):
      """Data generator for fluid.layers.py_reader"""
      B = self.config["train_batch_size"]
      while True:
          sample_data = self.sample_data_queue.get()
          self.sample_total_steps += len(sample_data["obs"])
          for key in sample_data:
              self.batch_buffer[key].extend(sample_data[key])
  
          if len(self.batch_buffer["obs"]) >= B:
              batch = {}
              for key in self.batch_buffer:
                  batch[key] = np.array(self.batch_buffer[key][:B])
  
              obs_np = batch["obs"].astype("float32")
              actions_np = batch["actions"].astype("int64")
              advantages_np = batch["advantages"].astype("float32")
              target_values_np = batch["target_values"].astype(
                  "float32"
              )
  
              self.lr = self.lr_scheduler.step()
              self.lr = np.array(self.lr, dtype="float32")
              self.entropy_coeff = self.entropy_coeff_scheduler.step()
              self.entropy_coeff = np.array(
                  self.entropy_coeff, dtype="float32"
              )
  
              yield [
                  obs_np,
                  actions_np,
                  advantages_np,
                  target_values_np,
                  self.lr,
                  self.entropy_coeff,
              ]
  
              for key in self.batch_buffer:
                  self.batch_buffer[key] = self.batch_buffer[key][B:]
  
imports: from parl.utils import check_version_for_fluid
  import gym
  import numpy
  import os
  from six.moves import queue
  import six
  import time
  import threading
  import parl
  from atari_model import AtariModel
  from atari_agent import AtariAgent
  from collections import defaultdict
  from parl.env.atari_wrappers import wrap_deepmind
  from parl.utils import logger, get_gpu_count, summary
  from parl.utils.scheduler import PiecewiseScheduler
  from parl.utils.time_stat import TimeStat
  from parl.utils.window_stat import WindowStat
  from parl.utils.rl_utils import calc_gae
  from parl.utils import machine_info
  from actor import Actor
label_desc: Use image node_id 2 for calling the Learner obj's underlying member method code with example usage: obj.learn_data_provider() without return types