About gradient descent with multioutput networks

I have difficulties understanding the concept of multi-output network. How can the optimization of the network be done if there is two output and thus two loss functions to optimize together ? How is the gradient computed under the hood ?

Thanks in advance for the help

The gradient will be one value for the main branch until that branch splits up to parts where each branch will have different gradient values to accomodate for each output and the loss function used.

This has been discussed here before if you scroll down the questions.