A two-dimensional semiconductor photodiode array senses and processes optical images simultaneously without latency, and is trained to classify and encode images with high throughput, acting as an artificial neural network.