Skip to content

Commit

Permalink
only initialize if training
Browse files Browse the repository at this point in the history
  • Loading branch information
RasmusOrsoe committed Sep 16, 2024
1 parent ecd1627 commit 9aa6936
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/graphnet/models/task/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ def forward(
labels = labels.to(self.dtype)
# Set the initial parameters of flow close to truth
# This speeds up training and helps with NaN
if self._initialized is False:
if (self._initialized is False) & (self.training):
self._flow.init_params(data=deepcopy(labels).cpu())
self._flow.to(self.device)
self._initialized = True # This is only done once
Expand Down

0 comments on commit 9aa6936

Please sign in to comment.