Slight generalization of neural net