If I understand the use case correctly, you are looking for a generic “reduction” method, which would take the desired reduction type as an argument?
If so, then unfortunately PyTorch doesn’t provide this generic method.
You could pass a reduction argument to the functional calls of some criteria, e.g. F.mse_loss(..., reduction=reduction), but this would of course only work for this particular criterion.