Closed nitsanhasson closed 3 years ago
@sushreebarsa Thanks for the reply, but my error is different. The outputs are correct but are in the wrong order. I thought this may be a dictionary related error since I was using Python 3.6, but the same thing happens with Python 3.9.
I need the models outputs to be in the same order both when I create and use the model without saving it, and when loading it.
Another thing I was trying to do is give the outputs names, so that when loading the saved model I can get the different tensors by their keys instead of their index, but for some reason, when loading the model those names are not retrieved.
I'm really stuck at this point because those outputs are needed for another model
@jvishnuvardhan Was able to reproduce the issue on Colab using TF v2.5, 2.6 and tf-nightly, Please find the gist here for reference. Thanks!
@jvishnuvardhan any updates?
@nitsanhasson I updated your code little bit as shown in this gist.
Mainly i changed input as a dictionary and also changed loading the keras model using tf.keras.models.load_model
instead of tf.saved_model.load
.
Please verify once and close the issue if this was resolved for you. Thanks!
@jvishnuvardhan that looks good, thanks!
System information
Describe the current behavior I have a model that outputs several tensors, each with a different shape and dtype, let's call it model A. Model's A output tensors are the input of another model B. What I would like to do is to be able to save model A (using model.save("...")), and then use it later by loading it. I found out that when loading model A and calling it, the outputs order in non deterministic, which causes a problem when I try to use those outputs as inputs to model B.
Describe the expected behavior I'd like the model to maintain the original outputs order
Standalone code to reproduce the issue Provide a reproducible test case that is the bare minimum necessary to generate the problem. If possible, please share a link to Colab/Jupyter/any notebook.