Open eugen-vusak opened 2 years ago
@gadagashwini I was able to replicate the issue, please find the gist here . Thank you!
Thanks for the report @eugen-vusak - we don't see an immediate priority needed for this but if you're interested, we welcome a PR from you and take a look if the request makes sense.
If you open a GitHub issue, here is our policy:
It must be a bug, a feature request, or a significant problem with the documentation (for small docs fixes please send a PR instead). The form below must be filled out.
Here's why we have that policy:.
Keras developers respond to issues. We want to focus on work that benefits the whole community, e.g., fixing bugs and adding features. Support only helps individuals. GitHub also notifies thousands of people when issues are filed. We want them to see you communicating an interesting problem, rather than being redirected to Stack Overflow.
System information. Linux 5.18.9-arch1-1
TensorFlow version (you are using): 2.9.0 Are you willing to contribute it (Yes/No) : Yes
Describe the feature and the current behavior/state.
When I have custom layer that returns dict of tensors then I would like for loss to use those names because order could change if outputs change.
For example, referencing the code bellow, if I set
my_layer_1_mse
as a monitor variable in early stopping and change other outputs this will no longer work ifout2
changes frommy_layer_1_mse
to e.g.my_layer_2_mse
I believe that loss and metrics be named
out1_loss
andout2_mse
in this specific case. Or at leastmy_layer_out1_loss
andmy_layer_out2_loss
Another problem is that I would like for model outputs to follow same naming convention if possible when exporting model to, for example, to tfjs. Currently outputs will be named
my_layer
andmy_layer_1
instead ofout1
andout2
respectively. Again requesting an web page to update every time underlying implementation is changed.This is possible to do using Model sub-classing instead of Functional API but then some other problems arise because Functional API is just so convenient.
Same problem is with tensorflow-serving. Outputs are named based on node names and if I return outputs that are dict, e.g.
{"out1": out1_var, "out2": out2_var}
than REST API response will not be {"output1": [...], "output2": [...]} but it will be some random complex node name that can change in the future. This can be achieved by using custom signatures when saving a model but I think this should default behavior to use names from outputs for both.I think this will make everything more consistent and allow for better deployment and monitoring solutions.
Here is a simple code snippet explaining situation:
and when training loss is called by node name which can be seen here:
Will this change the current api? How? This will change default loss name and exported model output names for everybody that use named outputs.
Who will benefit from this feature? Everybody who uses named outputs and doesn't want for loss names and exported model output names change with implementation of the same model.
Contributing