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).