From e0faa3b609eef69fd776e83d9e27032014d80aa5 Mon Sep 17 00:00:00 2001 From: AsukaMinato Date: Sun, 18 Jun 2023 00:39:11 +0900 Subject: [PATCH] use generator-expressions to not build it at a time. --- package/fsrs4anki_optimizer/fsrs4anki_optimizer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/fsrs4anki_optimizer/fsrs4anki_optimizer.py b/package/fsrs4anki_optimizer/fsrs4anki_optimizer.py index 1a25a8a..bf4dfa8 100644 --- a/package/fsrs4anki_optimizer/fsrs4anki_optimizer.py +++ b/package/fsrs4anki_optimizer/fsrs4anki_optimizer.py @@ -142,7 +142,7 @@ def __init__(self, data_source: RevlogDataset, batch_size: int): self.generator.manual_seed(seed) def __iter__(self): - yield from [self.batch_indices[idx] for idx in torch.randperm(self.batch_nums, generator=self.generator).tolist()] + yield from (self.batch_indices[idx] for idx in torch.randperm(self.batch_nums, generator=self.generator).tolist()) def __len__(self): return len(self.data_source)