I would like to create a neural network in Keras/Tensorflow which has multiple outputs. I would like to create a SINGLE loss function which takes all outputs into account and computes the loss accordingly. I need to do this because the outputs are related to each other. How can I achieve this? I read about concatenating all outputs to a single dense layer and then calculating the loss for this layer. Is there a more convenient way to achieve a single loss for multiple outputs yet?
I'm thinking of something like:
def my_custom_loss(y_true_0, ..., y_true_n, y_pred_0, ..., y_pred_n):
return something
y_true_0, ..., y_true_n
and y_pred_0, ..., y_pred_n
should be the true / predicted outputs of n output (dense) layers.