Skip to content

Commit

Permalink
No gradients before torch predictions
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmedfgad committed Sep 21, 2024
1 parent 9ffa344 commit e17b999
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pygad/torchga/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from .torchga import *

__version__ = "1.3.0"
__version__ = "1.4.0"
5 changes: 3 additions & 2 deletions pygad/torchga/torchga.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ def predict(model, solution, data):
_model = copy.deepcopy(model)
_model.load_state_dict(model_weights_dict)

predictions = _model(data)
with torch.no_grad():
predictions = _model(data)

return predictions
return predictions

class TorchGA:

Expand Down

0 comments on commit e17b999

Please sign in to comment.