Skip to content

Commit 26f15f6

Browse files
jannisbornKiddoZhu
andauthored
fix: RuntimeError if batch has only invalid mols (#84)
* fix: RuntimeError if batch has only invalid mols Co-authored-by: Zhaocheng Zhu <zhaochengzhu@pku.edu.cn>
1 parent b411837 commit 26f15f6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

torchdrug/data/graph.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1219,7 +1219,7 @@ def __getitem__(self, index):
12191219

12201220
index = self._standarize_index(index[0], self.batch_size)
12211221
count = index.bincount(minlength=self.batch_size)
1222-
if count.max() > 1:
1222+
if self.batch_size > 0 and count.max() > 1:
12231223
graph = self.repeat_interleave(count)
12241224
index_order = index.argsort()
12251225
order = torch.zeros_like(index)

0 commit comments

Comments
 (0)