@Utils.timeIt
    def evalFunction(self, m, return_g=True, return_H=True):

        self.curModel = m
        gc.collect()

        # Store fields if doing a line-search
        u = self.getFields(m, store=(return_g==False and return_H==False))

        phi_d = self.dmisfit.eval(m, u=u)
        phi_m = self.reg.eval(m)

        self.dpred = self.survey.dpred(m, u=u)  # This is a cheap matrix vector calculation.

        self.phi_d, self.phi_d_last  = phi_d, self.phi_d
        self.phi_m, self.phi_m_last  = phi_m, self.phi_m

        f = phi_d + self.beta * phi_m

        out = (f,)
        if return_g:
            phi_dDeriv = self.dmisfit.evalDeriv(m, u=u)
            phi_mDeriv = self.reg.evalDeriv(m)

            g = phi_dDeriv + self.beta * phi_mDeriv
            out += (g,)

        if return_H:
            def H_fun(v):
                phi_d2Deriv = self.dmisfit.eval2Deriv(m, v, u=u)
                phi_m2Deriv = self.reg.eval2Deriv(m, v=v)

                return phi_d2Deriv + self.beta * phi_m2Deriv

            H = sp.linalg.LinearOperator( (m.size, m.size), H_fun, dtype=m.dtype )
            out += (H,)
        return out if len(out) > 1 else out[0]
Backward propagation activation function derivative.
dataset/ETHPy150Open simpeg/simpeg/SimPEG/InvProblem.py/BaseInvProblem.evalFunction--crossover with--dataset/ETHPy150Open clips/pattern/pattern/vector/__init__.py/dsigmoid