Efficient way of finding Cross Entropy

I have a list, which stores N tensors of dimension B*C, where B is the batch size and C is the total classes possible. [Y_1, Y_2, Y_3,....Y_N]. I also have a target list which stores the N target labels, each of dimension B*1.

I want to calculate the cross entropy of each individual batch with its corresponding target in the target list. I can write a loop to do that, but I was wondering if there’s more effective way of achieving this.