On invariance and selectivity in representation learning