import tensorflow as tf

      # self.learning_rate -- you can get this from self.optimizer_spec.lr_schedule.value(t)
      # (this is needed by the optimizer to choose the learning rate)
      # 3.d: periodically update the target network by calling
      # self.session.run(self.update_target_fn)
      # you should update every target_update_freq steps, and you may find the
      # variable self.num_param_updates useful for this (it was initialized to 0)
      
      obs_batch, act_batch, rew_batch, obs_tp1_batch, done_mask = self.replay_buffer.sample(self.batch_size)

      if not self.model_initialized:
        initialize_interdependent_variables(self.session, tf.global_variables(),
                                            {self.obs_t_ph : obs_batch, self.obs_tp1_ph : obs_tp1_batch})
        self.model_initialized = True
    
      self.session.run(self.train_fn, {self.obs_t_ph: obs_batch, self.act_t_ph: act_batch, self.rew_t_ph: rew_batch,
                                       self.obs_tp1_ph: obs_tp1_batch, self.done_mask_ph: done_mask,
                                       self.learning_rate : self.optimizer_spec.lr_schedule.value(self.t)},
                                      options=tf.RunOptions(report_tensor_allocations_upon_oom=True))

   
