Memory capacity of three-layer neural networks with non-polynomial activations