code: def L2(layer="input", constant=0, epsilon=1e-6, batch=None):
    
    if batch is None:
      return lambda T: tf.sqrt(epsilon + tf.reduce_sum((T(layer) - constant) ** 2))
    else:
      return lambda T: tf.sqrt(epsilon + tf.reduce_sum((T(layer)[batch] - constant) ** 2))
docs: L2 norm of layer. Generally used as penalty.