I am training a network with batch optimization over my training set, and I would like to get a loss vector containing the loss of each of my training examples.
More specifically I am using images (of size 3x64x64
) in a batch of size 64. Therefore my input is a tensor of size 64x3x64x64
.
During training when I write
output = net:forward(input)
loss = criterion:forward(input, target)
loss
is a number, but I would like to get a tensor (of size 64) with one entry per image in my batch, corresponding to the loss value of this precise image.
Is there a way to do that without looping on the first dimension of my input tensor?