def fgrad_y(self, y, return_precalc=False):
d = self.d<EOL>mpsi = self.psi<EOL>S = (mpsi[:,<NUM_LIT:1>] * (y[:,:,None] + mpsi[:,<NUM_LIT:2>])).T<EOL>R = np.tanh(S)<EOL>D = <NUM_LIT:1> - (R ** <NUM_LIT:2>)<EOL>GRAD = (d + (mpsi[:,<NUM_LIT:0>:<NUM_LIT:1>][:,:,None] * mpsi[:,<NUM_LIT:1>:<NUM_LIT:2>][:,:,None] * D).sum(axis=<NUM_LIT:0>)).T<EOL>if return_precalc:<EOL><INDENT>return GRAD, S, R, D<EOL><DEDENT>return GRAD<EOL>
gradient of f w.r.t to y ([N x 1])

:returns: Nx1 vector of derivatives, unless return_precalc is true, 
then it also returns the precomputed stuff