Hi,
Unfortunately, it is not currently possible to define a custom loss in the python code like you would do with classical Keras models.
Instead, custom losses are created by extending the C++ AbstractLoss class 3 and implementing the corresponding methods (e.g. loss value, gradient). This 8 is the list of the currently available losses.
Specific losses can be requested by posting an issue 3 with the “Enhancement” tag.
Cheers,
M.