It would be useful to have losses that return a batch of losses, rather than summing/mean-ing them. This is useful e.g. for adding weights on the loss that vary for each batch element, and for masking losses on the outputs of variable-length RNNs.
Most common losses can be emulated using element-wise arithmetic (or in the case of the categorical NLL, a Gather operation), and that was my standard solution in lua torch. However, having them built-in is arguably cleaner and leads to more consistent code for the end user.
It would be useful to have losses that return a batch of losses, rather than summing/mean-ing them. This is useful e.g. for adding weights on the loss that vary for each batch element, and for masking losses on the outputs of variable-length RNNs.
Most common losses can be emulated using element-wise arithmetic (or in the case of the categorical NLL, a Gather operation), and that was my standard solution in lua torch. However, having them built-in is arguably cleaner and leads to more consistent code for the end user.