Right. I want these weights to be a function of my data and current state.
weights = ae_class_dist[:, class_i]
weight_cat = torch.cat([Variable(torch.ones(features_a_i.size(0))).cuda(),
                        weights], 0)
cross_ent = F.binary_cross_entropy(F.sigmoid(output.view(-1)),
                                   full_y.view(-1), weight=weight_cat.data)
total_dist += cross_ent

and then optimize total_dist. According to docs, it seems possible
    weight (Variable, optional): a manual rescaling weight
            if provided it's repeated to match input tensor shape

Thanks!
(O