Skip to content

Commit

Permalink
use generator-expressions to not build it at a time. (#306)
Browse files Browse the repository at this point in the history
  • Loading branch information
asukaminato0721 authored Jun 18, 2023
1 parent 9b3ca42 commit 8fcf038
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion package/fsrs4anki_optimizer/fsrs4anki_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 8fcf038

Please sign in to comment.