On-device machine learning with memristors in the neuromorphic era