Gated recurrent neural networks discover attention