import tensorflow as tf


        # create update operations
        var_bkup_update_op = var_bkup.assign(tf.where(mask > 0.5, var, var_bkup))
        with tf.control_dependencies([var_bkup_update_op]):
          mask_thres = tf.contrib.distributions.percentile(tf.abs(var_bkup), prune_ratio * 100)
          mask_update_op = mask.assign(tf.cast(tf.abs(var_bkup) > mask_thres, tf.float32))
        with tf.control_dependencies([mask_update_op]):
          prune_op = var.assign(var_bkup * mask)
