Recieve list of all outputs as input to a custom loss function.
See original GitHub issueImportant note: the development of Keras is currently taking place at github.com/tensorflow/tensorflow
. Please file your bug report by creating a new issue in the TensorFlow repository.
Please note that multi-backend Keras development has been discontinued. Do not report issues about multi-backend Keras (Keras 2.3.1 and lower), only report issues about the TensorFlow implementation of Keras (tf.keras).
Issue Analytics
- State:
- Created 3 years ago
- Comments:16 (1 by maintainers)
Top Results From Across the Web
How to access all outputs from a single custom loss function in ...
FINALLY, THE FIX WAS to concatenate the vectors together (along axis=1 this case) and on the loss function, take them apart:
Read more >Custom loss function with multiple outputs in tensorflow
my network has two outputs and single input. I am trying to write a custom ...
Read more >Advanced Keras - Custom loss functions - Petamind
A machine learning model may need custom loss function. You can use a different loss on each output by passing a dictionary or...
Read more >How To Build Custom Loss Functions In Keras For Any Use ...
In deep learning, the loss is computed to get the gradients for the model weights and update those weights accordingly using backpropagation. What...
Read more >Losses - Keras
All built-in loss functions may also be passed via their string ... pass optimizer by name: default parameters will be used ... Creating...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I have the same problem too. my model outputs 3 tensors.
model= Model(inputs = inputs,outputs =[predicted_image,depth,x_train])
my loss function should be
` def depth_loss_function(y_true, y_pred):
compile method
model.compile(optimizer= optimizer, loss =depth_loss_function)
error 1 : y_pred is only first tensor. error 2 : by using predict_image, depth , input_image = y_pred Tensor objects are only iterable when eager execution is enabled. To iterate over this tensor use tf.map_fn.
Yes, I created a custom keras layer (as last layer in my function), and inside it I used self.add_loss function (you can pass any function with any number of parameters in add_loss).