Separate losses for batch training

I have a batch of 10 items and I want the loss function to return 10 losses (one for each one). Can it be done without iterating over each one and calculate it separately?

It depends on your loss function, if it supports the reduce keyword argument, then setting it to False will do what you want. Otherwise, you will have to iterate I’m afraid (or compute it by hand without the reduce operation at the end).

1 Like

reduce did the job, thanks!