Neural Networks Regularization Through Class-wise Invariant Representation Learning