import tensorflow as tf

    return masks, tf.group(prune_ops)

  def __calc_prune_ratio_dyn(self, prune_ratio_fnl):
    """Calculate the dynamic pruning ratio.
    Args:
    * prune_ratio_fnl: final pruning ratio
    Returns:
    * prune_ratio_dyn: dynamic pruning ratio
    """

    idx_iter_beg = int(self.nb_iters_train * FLAGS.ws_iter_ratio_beg)
    idx_iter_end = int(self.nb_iters_train * FLAGS.ws_iter_ratio_end)
    base = tf.cast(self.global_step - idx_iter_beg, tf.float32) / (idx_iter_end - idx_iter_beg)
    base = tf.minimum(1.0, tf.maximum(0.0, base))
    prune_ratio_dyn = prune_ratio_fnl * (1.0 - tf.pow(1.0 - base, FLAGS.ws_prune_ratio_exp))

    return prune_ratio_dyn

  def __calc_grads_pruned(self, grads_origin):
    """Calculate the mask-pruned gradients.
    Args:
    * grads_origin: list of original gradients
    Returns:
    * grads_pruned: list of mask-pruned gradients
