From aa73bff23c5805706e5aa6b0646730159d1c8ceb Mon Sep 17 00:00:00 2001 From: NicolaCourtier <45851982+NicolaCourtier@users.noreply.github.com> Date: Fri, 17 May 2024 17:03:13 +0100 Subject: [PATCH] Update to lambda functions Co-authored-by: Brady Planden <55357039+BradyPlanden@users.noreply.github.com> --- pybop/optimisers/base_optimiser.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/pybop/optimisers/base_optimiser.py b/pybop/optimisers/base_optimiser.py index ab3a30c2b..c5e475422 100644 --- a/pybop/optimisers/base_optimiser.py +++ b/pybop/optimisers/base_optimiser.py @@ -189,13 +189,9 @@ def _run(self): # Choose method to evaluate if self._needs_sensitivities: - - def f(x): - return self.cost.evaluateS1(x, minimising=self._minimising) + f = lambda x: self.cost.evaluateS1(x, minimising=self._minimising) else: - - def f(x, grad=None): - return self.cost(x, grad, minimising=self._minimising) + f = lambda x, grad=None: self.cost(x, grad, minimising=self._minimising) # Create evaluator object if self._parallel: