2

I have a Keras model with multiple output layers. I want to have a loss function, that computes a loss based on two of the model output layers.

Can I do this in a simple way, without using a custom train loop or adding a layer for this?

5
  • do you need a single loss function to handle all outputs, or do you have a separate loss function for each output? Commented Feb 4 at 7:18
  • I need a loss function to handle multiple (two of three outputs). Commented Feb 4 at 12:27
  • This question is similar to: Multi-input Multi-output Model with Keras Functional API. If you believe it’s different, please edit the question, make it clear how it’s different and/or how the answers on that question are not helpful for your problem. Commented Feb 7 at 11:57
  • @Innat while the linked question is also about a non-sequential model with multiple output layers, its answer doesn't explain how to define a single loss function for multiple output layers. Therefore, I think that this question is distinct enough to leave it open. Commented Feb 8 at 15:52
  • @Aemyl Not really. The linked answer explains well how multi-output should work in keras training. While your answer is solely based on assumption. The OP didn't add minimum code to make his point. Please avoid that type of answer which is simply a comment, I mean, you can just simply comment this keras.io/guides/functional_api/… Commented Feb 9 at 16:17

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.