Skip to content

Commit 171c510

Browse files
committed
fix ut
1 parent 45e90ea commit 171c510

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

deepmd/pt/train/training.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,10 @@ def cycle_iterator(iterable: Iterable):
172172
------
173173
Any: The next item from the iterable, cycling back to the beginning when the end is reached.
174174
"""
175-
with torch.device("cpu"):
176-
while True:
177-
yield from iterable
175+
while True:
176+
with torch.device("cpu"):
177+
it = iter(iterable)
178+
yield from it
178179

179180
def get_data_loader(_training_data, _validation_data, _training_params):
180181
def get_dataloader_and_iter(_data, _params):

0 commit comments

Comments
 (0)