Machine learning is the core of artificial intelligence. Using optical signals for training and converting them into electrical signals for inference, combines the strengths of both, and thus can greatly improve machine learning efficiency. Optoelectronic memories are the hardware foundation for this strategy. However, the existing optoelectronic memories cannot modulate a large number of non-volatile resistive states using ultra-short and ultra-dim light pulses, leading to low training accuracy, slow computing speed and high energy consumption. Here, we synthesized a van der Waals layered photoconductive material, (NH