import tensorflow as tf


        self.train_summary = tf.summary.merge_all(key='train')
        self.eval_summary = tf.summary.merge_all(key='eval')
        self.saver = tf.train.Saver(tf.global_variables())

    def separate_gradient_update(self):
        denoise_params = tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES, "denoising_model")
        ranking_model_params = tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES, "ranking_model")
        self.weighs_propen=denoise_params
        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)
