Entry_wise binary_cross_entropy

It seems that the F.binary_cross_entropy function takes two tensors a and b. It view both of them as vectors and compute the cross_entropy between a_i and b_i and then take sum of i.

I am wondering whether there is a way to compute a vector whose i-th coordinate is the binary cross entropy of a_i and b_i?

on pytorch-master, we have been converting several loss functions to have a reduce=False argument that returns non-summed losses. That’s what you are looking for. BCE hasn’t been converted yet. Ping @richard to ask him to prioritize it up and get it done next week: https://github.com/pytorch/pytorch/issues/264#issuecomment-340011845

Thanks! No rush.

I implemented it from scratch as a temporary solution. (But not sure whether there might be any numerical precision issues with it.)