Learning Layer-wise Equivariances Automatically using Gradients