In fact, I do not think this will work as I want. Since I want to calculate the loss of each bit in lower 14 bits only when its predict is equal to the target, in a bit-wise manner.
For example, if target[:, 14] = [0 1 1] and prediction[:, 14] = [0 1 0], I would like to calculate the second part loss of first two samples without the third one since its prediction is different from the third one.