A reconfigurable WSe2 photodiode array performs image sensing and neural-network operations in the same device. The approach reduces the need to move image data through a separate processing chain and demonstrated classification and encoding at a throughput of 20 million bins per second.