loss function input "y_pred" should be full list of model-outputs #46428
Labels
comp:keras
Keras related issues
stat:awaiting tensorflower
Status - Awaiting response from tensorflower
type:feature
Feature requests
System information
Describe the feature and the current behavior/state.
In the current version of Keras, the loss function is applied for each output of the model elementwise (if there are multiple), or one can define for each individual output one loss function. This seems to be not really consistent with other fundamentals in Keras / TF, and it would be better to have at least the possibility to get the full list of model-outputs as a y_pred input of the loss function. It's especially confusing since in the train_step
tensorflow/tensorflow/python/keras/engine/training.py
Lines 790 to 791 in a338a52
one passes the full list of model-outputs as y_pred, but the loss function is run multiple times for each individual model-output and hence gets every element of the list separately as y_pred
Will this change the current api? How?
Yes, there wouldn't be multiple losses for a model but only one. One could still get the same results by building a "wrapper" around the individual losses and adding it as a loss.
Who will benefit from this feature?
Everyone who wants to build more complex models, especially if you have different output dimensions in your model-output, where the proposed solution is in keras-team/keras#14140 would not work anymore (e.g., one output an image and one output a label).
Any Other info.
The text was updated successfully, but these errors were encountered: