The masked tensor should be a flattened one so I’m unsure how your normalization layer would work with this type of input:
x = torch.randn(10, 10)
mask = torch.randint(0, 2, (10, 10)).bool()
print(x[mask].shape)
> torch.Size([49])