I have a global value in init function. I want to increase it as the number of epoch. However, it reset to zero every epoch. How should I fix it
import torch.utils.data as data

class My_Dataset(data.Dataset):

    def __init__(self, data_list):
        self.rand_num=0
    def __getitem__(self, index):
         self.rand_num +=1

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