Description
As discussed in #6457
The current problem
We do not restrict the reduction mode in losses. There are only three cases possible, ["none", "mean", "sum"]. If the user passes something like "xyz" we are not throwing any error or warning.
The solution
If users aren't passing one of the valid cases and using a random string instead. It's better to throw a ValueError suggesting them to use one of the correct choice.
We had thought of Enum based solution, but to keep better consistency with Pytorch core as discussed, we are adopting the above solution.
Edits required
Need to edit losses. which are namely
ciou_loss, diou_loss, giou_loss, and focal_loss
Also need to edit the relevant tests in test_ops.py
Additional Context
I think it's good first issue and some new contributor can take this 😃
Feel free to ping the maintainers or me if you need help. 😄