function f=fun(W,Inp,Tar,NNP) [Y,G,E]=TwoLayer(Inp,Tar,W,NNP); f=norm(Y-Tar);