Index error while using a transformation in MNIST dataset

Hi!. I am using a neural network with MNIST dataset. I want to make a transformation to this data in which I put to zero 392 pixels of the images. So I have created a list “L” with the pixels I want to be zero (for example, L = [(1,2), (23,5),…], where len(L) = 392). However I get an “Index error” and I do not know how to solve it. Thanks in advance!!. I have attached the code I am refering to.


Image2

Image4

Could you post a minimal, executable code snippet reproducing the issue by wrapping it into three backticks ```, please?

Okey!. I think the error can be solved just adding in class Pixels_Zero “tensor[0][self.L[i]]=0”, but I do not understand very well why this solve the problem. Thanks in advance!!