# Does \_\_getitem\_\_ of dataloader reset random seed?

**URL:** <https://discuss.pytorch.org/t/does-getitem-of-dataloader-reset-random-seed/8097>\
**Category:** Uncategorized\
**Created:** [September 29, 2017, 11:47pm UTC](https://discuss.pytorch.org/t/does-getitem-of-dataloader-reset-random-seed/8097 "2017-09-29T23:47:10Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![smth](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/smth/32/13_2.png) [@smth](https://discuss.pytorch.org/u/smth)\
**Post date:** [September 30, 2017, 3:01pm UTC](https://discuss.pytorch.org/t/does-getitem-of-dataloader-reset-random-seed/8097/3 "2017-09-30T15:01:05Z")

</div>

This is the small (hopefully easy to follow function):

> <https://github.com/pytorch/pytorch/blob/master/torch/utils/data/dataloader.py#L129>

On each ` __iter__ ` the DataLoader returns a new one of these iterators: [https://github.com/pytorch/pytorch/blob/master/torch/utils/data/dataloader.py#L302](https://github.com/pytorch/pytorch/blob/master/torch/utils/data/dataloader.py#L302)

The iterator creates a new `self.workers` everytime it’s created: [https://github.com/pytorch/pytorch/blob/master/torch/utils/data/dataloader.py#L151-L155](https://github.com/pytorch/pytorch/blob/master/torch/utils/data/dataloader.py#L151-L155)

---

_[View the full topic](https://discuss.pytorch.org/t/does-getitem-of-dataloader-reset-random-seed/8097)._
