# Data loading issue

**URL:** <https://discuss.pytorch.org/t/data-loading-issue/8318>\
**Category:** Uncategorized\
**Created:** [October 4, 2017, 11:43pm UTC](https://discuss.pytorch.org/t/data-loading-issue/8318 "2017-10-04T23:43:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ray342659093](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/ray342659093/32/4597_2.png) [@ray342659093](https://discuss.pytorch.org/u/ray342659093)\
**Post date:** [October 4, 2017, 11:43pm UTC](https://discuss.pytorch.org/t/data-loading-issue/8318/1 "2017-10-04T23:43:52Z")

</div>

for i, (input, target) in enumerate(train\_loader):  
# measure data loading time

```
data_time.update(time.time() - end)

some operations

end = time.time()

```

when doing this operation to measure the data loading time, sometimes the avg time start from around 0.06 and keep it in this level during training. In this situation, the training speed is fast. but sometimes the avg time start from more then 2 and then slowly decrease after each epoch and eventually become a small number after tens of epochs. I run the code in the same machine with the same dataset and the same number of workers. I was wondering what causes this problem and is there any solution?
