code: def weight(w, sparsity):
      """Weight-level magnitude pruning."""
      w_shape = common_layers.shape_list(w)
      k = int(np.prod(w_shape[:-1]))
      count = tf.to_int32(k * sparsity)
      mask = common_layers.weight_targeting(w, count)
      return (1 - mask) * w
  
imports: import numpy
  from tensor2tensor.layers import common_layers
  from tensor2tensor.utils import registry
  import tensorflow.compat.v1
label_desc: Use image node_id 1 for calling a global function with example usage: weight(w, sparsity) and returns: unknown