We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 45e90ea commit 171c510Copy full SHA for 171c510
1 file changed
deepmd/pt/train/training.py
@@ -172,9 +172,10 @@ def cycle_iterator(iterable: Iterable):
172
------
173
Any: The next item from the iterable, cycling back to the beginning when the end is reached.
174
"""
175
- with torch.device("cpu"):
176
- while True:
177
- yield from iterable
+ while True:
+ with torch.device("cpu"):
+ it = iter(iterable)
178
+ yield from it
179
180
def get_data_loader(_training_data, _validation_data, _training_params):
181
def get_dataloader_and_iter(_data, _params):
0 commit comments