Learning Invariant Weights in Neural Networks