The WSe 2 -based memristor demonstrates the controllable digital and analog resistive switching behavior. Moreover, it can be used to emulate the “learning-forgetting-relearning” experience and performs image recognition with high recognition accuracy.