Skip to content

Commit

Permalink
fix: RuntimeError if batch has only invalid mols (DeepGraphLearning#84)
Browse files Browse the repository at this point in the history
* fix: RuntimeError if batch has only invalid mols

Co-authored-by: Zhaocheng Zhu <[email protected]>
  • Loading branch information
jannisborn and KiddoZhu authored Apr 23, 2022
1 parent b411837 commit 26f15f6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion torchdrug/data/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -1219,7 +1219,7 @@ def __getitem__(self, index):

index = self._standarize_index(index[0], self.batch_size)
count = index.bincount(minlength=self.batch_size)
if count.max() > 1:
if self.batch_size > 0 and count.max() > 1:
graph = self.repeat_interleave(count)
index_order = index.argsort()
order = torch.zeros_like(index)
Expand Down

0 comments on commit 26f15f6

Please sign in to comment.