pchandrasekaran:

mask = mask.reshape(s*s, s, s)


So in my case s = 14
mask = mask.reshape(s * s, s, s)
RuntimeError: shape '[196, 14, 14]' is invalid for input of size 14


mask = torch.diag(mask_setup)

– > torch.Size([14])
so it does not work, but maybe you can explain me your idea?