Skip to content

Commit

Permalink
fixed mistake in float casting return value of loss generators
Browse files Browse the repository at this point in the history
  • Loading branch information
Oskar Taubert committed Apr 19, 2024
1 parent 7b50352 commit 0f9fcc9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions propulate/propulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,11 +289,11 @@ def loss_fn(individual):
# Check if ``loss_fn`` is generator, prerequisite for surrogate model.
if inspect.isgeneratorfunction(self.loss_fn):
last = float("inf")
for last in float(loss_fn(ind)):
for last in loss_fn(ind):
if self.surrogate is not None:
if self.surrogate.cancel(last): # Check cancel for each yield.
break
ind.loss = last # Set final loss as individual's loss.
ind.loss = float(last) # Set final loss as individual's loss.
else:
ind.loss = float(loss_fn(ind)) # Evaluate its loss.

Expand Down

0 comments on commit 0f9fcc9

Please sign in to comment.