mask[i], var[i] or mu[i] will most likely return a non-scalar tensor, which cannot be converted to bool.
Have a look at this dummy example:
x = torch.randn(1, 2)
if x[0]==1:
    print('passed')

As x[0] returns a tensor of shape torch.Size([2]), the comparison will also have the same shape, e.g. tensor([0, 0], dtype=torch.uint8).
If you want to check, if all values are equal to 1, you can use:
if (x[0]==1).all():
    print('passed')

, but obviously this depends on your use case.