An on-chip learning neural network