Skip to content

Commit

Permalink
replaced model.apply with predict_batch in the optimization loop
Browse files Browse the repository at this point in the history
  • Loading branch information
nepslor committed Dec 15, 2023
1 parent f9b9105 commit 0110491
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pyforecaster/forecasting_models/neural_forecasters.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ def optimize(self, inputs, objective, n_iter=200, rel_tol=1e-4, recompile_obj=Tr
normalized_inputs, _ = self.get_normalized_inputs(inputs)
x, y = normalized_inputs
def _objective(y, x, **objective_kwargs):
return objective(self.model.apply(self.pars, x, y), y, **objective_kwargs)
return objective(self.predict_batch(self.pars, [x, y]), y, **objective_kwargs)

# if the objective changes from one call to another, you need to recompile it. Slower but necessary
if recompile_obj:
Expand Down

0 comments on commit 0110491

Please sign in to comment.