def l2_regularizer(decay, name_filter='weights'):
  """Create an l2 regularizer."""
  return regularizer(
      'l2_regularizer',
      lambda x: tf.nn.l2_loss(x) * decay,
      name_filter=name_filter)
Create an l2 regularizer.