티스토리 뷰

github.com/pytorch/pytorch/issues/1917

 

Get a single batch from DataLoader without iterating · Issue #1917 · pytorch/pytorch

Is it possible to get a single batch from a DataLoader? Currently, I setup a for loop and return a batch manually. If there isn't a way to do this with the DataLoader currently, I would be happ...

github.com

 

    dataloader_iterator = iter(dataloader)
    for i in range(iterations):
        try:
            data, target = next(dataloader_iterator)
        except StopIteration:
            dataloader_iterator = iter(dataloader)
            data, target = next(dataloader_iterator)
        do_something()
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/01   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함