import tensorflow as tf

        if self.hparams.l2_loss > 0:
            for p in denoise_params:
#                 self.weighs_propen=p
#                 p=tf.Print(p,[p],message="show the weights")
                self.exam_loss += self.hparams.l1_loss * tf.reduce_sum(tf.abs(p))
            for p in ranking_model_params:
                self.rank_loss += self.hparams.l2_loss * tf.nn.l2_loss(p)
        self.loss = self.exam_loss + self.hparams.ranker_loss_weight * self.rank_loss

        denoise_gradients = tf.gradients(self.exam_loss, denoise_params)
        ranking_model_gradients = tf.gradients(self.rank_loss, ranking_model_params)
        if self.hparams.max_gradient_norm > 0:
            denoise_gradients, denoise_norm = tf.clip_by_global_norm(denoise_gradients,
                                                                     self.hparams.max_gradient_norm)
            ranking_model_gradients, ranking_model_norm = tf.clip_by_global_norm(ranking_model_gradients,
                                                                     self.hparams.max_gradient_norm * self.hparams.ranker_loss_weight)
        self.norm = tf.global_norm(denoise_gradients + ranking_model_gradients)

        opt_denoise = self.optimizer_func(self.hparams.learning_rate)
        opt_ranker = self.optimizer_func(self.ranker_learning_rate)
