How to implement custom loss filter for neural networks [MPSCNNKerne]?

For training the model I need a special loss filter. Though Metal implements a couple of loss filters I need another one. Is it possible to create your own loss filter and if how?


PS: Actually I need a combination of a cross entropy and a mean squared average error filter.

PPS: The MPSCNN documentation is really sparse or not existing. Does anybody know a site that describes a bit the functionality?