L1 norm of layer. Generally used as penalty.

def L1(layer="input", constant=0, batch=None):
  """L1 norm of layer. Generally used as penalty."""
  if batch is None:
    return lambda T: tf.reduce_sum(tf.abs(T(layer) - constant))
  else:
    return lambda T: tf.reduce_sum(tf.abs(T(layer)[batch] - constant))