This topic seems to be widely discussed but I got a question. The document in the Pytorch indicate following formula:

image1374×402 47.4 KB

My question is related to N.
Let’s say my target size is [1* 1 * 10 * 10] - B,C,H,W
The output from my network is also [1* 1 * 10 * 10]  - B,C,H,W
In this case N = 1. Thus, according to the formula listed above, we should have following:
l(x,y) = L = { l1 } = -[ y1 log( x1 ) + (1 - y1) log(1 - x1)]
Question:
This problem have a target image, and output image instead of a particular scalar for target and output values. In such case how is l1 computed? Will it be computed pixel by pixel (10*10) and mean is taken to get l1?
The definition says mean can be used for batch N. So if I have  {l1, l2,…,lN}, it makes sense to compute L using mean formula, but nothing is said above how is l1 computed in the case of images?