Are you talking about self.rand_num? I tried iterating through the dataset using a data_loader, and the value of rand_num keeps increasing:
import torch
import torch.utils.data as data
from torch.utils.data import DataLoader


class My_Dataset(data.Dataset):

    def __init__(self, data_list):
        self.data_list = data_list
        self.rand_num=0

    def __getitem__(self, index):
         self.rand_num +=1
         return torch.tensor([self.data_list[index]])

    def __len__(self):
        return len(self.data_list)

vals = [i for i in range(20)]
ds = My_Dataset(vals)
data_loader = DataLoader(ds, batch_size=10)
print(ds.rand_num)
next(iter(data_loader))
print(ds.rand_num)

for epoch in range(5):
    for batch in data_loader:
        print(epoch, ds.rand_num)

which will print out the following epoch and rand_num:
0
10
0 20
0 30
1 40
1 50
2 60
2 70
3 80
3 90
4 100
4 110