I've been looking at this code [https://github.com/JuliaML/LossFunctions.jl/blob/cfcdc6a9d0f42d90ea4c2d268cc6be34e93d8926/src/losses.jl], specifically the unary fallback operations. I don't understand how that works in Julia. (loss::DistanceLoss)(output::Number, target::Number) = loss(output - target) this operator overload for example, is calling the same operator overload of the same class. How does that work, where is it defined?
Or a little bit below that we see this:
function sum(loss::SupervisedLoss, outputs, targets) sum(loss(ŷ, y) for (ŷ, y) in zip(outputs, targets)) end
But SupervisedLoss does not have a () overload defined, so what function will be called for loss(ŷ, y).