Solved by ptrblck in post #4 
              
              
                The shapes are also [32] in my example, but the number of True values in idx is 31. 
Indexing x with 31 True values will return a tensor of the shape [31]: 
x = torch.randn(32)
idx = torch.ones(32).bool()
idx[0] = False
print(x[idx].shape)
# > torch.Size([31])

which will then create the error since…