import tensorflow as tf

                        self.value_target_n = value_target_n

                with tf.variable_scope("loss", reuse=False):
                    # Take the min of the two Q-Values (Double-Q Learning)
                    min_qf_pi = tf.minimum(qf1_pi, qf2_pi)
                    
                    # Target for Q value regression
                    q_backup = tf.stop_gradient(
                        self.rewards_ph +
                        (1 - self.terminals_ph) * self.gamma * self.value_target
                    )

                    # Compute Q-Function loss
                    # TODO: test with huber loss (it would avoid too high values)
                    qf1_loss = 0.5 * tf.reduce_mean(((q_backup - qf1) ** 2)*self.weight_ph)
                    qf1_loss_col = tf.reduce_mean(((q_backup - qf1) ** 2),1)
                    qf2_loss = 0.5 * tf.reduce_mean(((q_backup - qf2) ** 2)*self.weight_ph)
                    if self.n_step:
                        q_backup_n = tf.stop_gradient(
                        self.rewards_ph_n +
                        (1 - self.terminals_ph_n) *( self.gamma**self.n_step_length ) * self.value_target_n)
                        qf1_loss_n = 0.5 * tf.reduce_mean(((q_backup_n - qf1) ** 2)*self.weight_ph)
                        qf1_loss_n_col = tf.reduce_mean(((q_backup_n - qf1) ** 2),1)
                        qf2_loss_n = 0.5 * tf.reduce_mean(((q_backup_n - qf2) ** 2)*self.weight_ph)
                    if self.n_step:
                        value_for_priority = qf1_loss_col + qf1_loss_n_col
                    else:
                        value_for_priority = qf1_loss_col
