A 2‐D neural network and its optical implementation are presented. The neural network consists of two interconnection layers. The first layer is a modified Hamming net layer that calculates the Hamming distance between the input and each of the stored patterns. Instead of performing a winner‐take‐all operation, thresholding is performed within each hidden neuron. The second layer is a mapping network for pattern association. The presented neural network has fewer interconnections and a higher storage capacity than a fully interconnected Hopfield network. In comparison with multilayer perceptrons, it has advantages such as easy and direct training and unipolar binary interconnection weights and therefore is more suitable for optical implementation with currently available optoelectronic devices. The neural network can be easily reconfigured when the training set needs to be updated or extra training patterns need to be added into the training set. The attraction basins of stored patterns can be adjusted, and the input fault tolerance can be enhanced locally. An optical system employing Dammann gratings has been used in the preliminary experiments. Experimental results verified the feasibility of the neural network model as well as its optical implementation. © 1996 Society of Photo−Optical Instrumentation Engineers.