The problem is that of text classification where each document can be identified with one or more labels (104). So given a prediction \hat{y} of size (batch_size, 104) and a multi-one hot vector y of size  (batch_size, 104) which consists of value 1 for the labels it contains and values 0 for the labels it does not contain, I would want a vector loss_labels of size (104, 1) where the value at position l in this vector is given by

Here y_i^l is the true lth label of ith sample and \hat{y}_i^l is the same thing for the predicted output.