Long-term memory in shape learning