Skip to content

Commit ad56ac9

Browse files
committed
fixed none gradient
None gradient appears when no interactions
1 parent d1b2a28 commit ad56ac9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

botnet/modules/utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ def compute_forces(energy: torch.Tensor, positions: torch.Tensor, training=True)
3434
only_inputs=True, # Diff only w.r.t. inputs
3535
allow_unused=False,
3636
)[0] # [n_nodes, 3]
37-
37+
if gradient == None:
38+
return torch.zeros_like(positions)
3839
return -1 * gradient
3940

4041

0 commit comments

Comments
 (0)