layer_loss function

Limited loss to the layer