I’m trying to modify the CIFAR10 class in torchivision.datasets (which is inherited from Dataset class).

What I did is just add a member variable `self.niter=0`

in `__init__`

method, and add 1 at when `__getitem__`

is called by adding one line `self.niter+=1`

Then, I printed `self.niter`

and `index`

in the `__getitem__`

for 10 epochs (I used only 90 data and batch_size 10 for debugging). I found that the `self.niter`

seems to be initialized to 0 at every epoch as follows.

```
('Epoch: ', 0)
index: 2 , niter: 0
index: 5 , niter: 1
index: 1 , niter: 2
index: 4 , niter: 3
index: 7 , niter: 4
index: 3 , niter: 5
index: 6 , niter: 6
index: 0 , niter: 7
('Epoch: ', 1)
index: 3 , niter: 0
index: 2 , niter: 1
index: 6 , niter: 2
index: 5 , niter: 3
index: 0 , niter: 4
index: 1 , niter: 5
index: 7 , niter: 6
index: 4 , niter: 7
('Epoch: ', 2)
index: 4 , niter: 0
index: 6 , niter: 1
index: 3 , niter: 2
index: 5 , niter: 3
index: 1 , niter: 4
index: 2 , niter: 5
index: 7 , niter: 6
index: 0 , niter: 7
('Epoch: ', 3)
index: 0 , niter: 0
index: 2 , niter: 1
index: 7 , niter: 2
index: 4 , niter: 3
index: 1 , niter: 4
index: 3 , niter: 5
index: 6 , niter: 6
index: 5 , niter: 7
...
('Epoch: ', 9)
index: 1 , niter: 0
index: 5 , niter: 1
index: 0 , niter: 2
index: 6 , niter: 3
index: 7 , niter: 4
index: 3 , niter: 5
index: 2 , niter: 6
index: 4 , niter: 7
```

What I expected was the `self.niter`

is getting larger without any bound. I don’t know why it is like that even though I don’t add any line to initialize it. Is there any way I can make it not to be initialized?