fix: Implemented support for loading models with Concatenate layers #1192
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is my first serious pullrequest so please be gentle :)
The
tf.keras.models.load_model()
is now able to load models with this layer type.There was a lot missing but I have a Unet model running in the field that now fully works.
I had some weird troubles with python tensorflow (im using 2.11.1) that savemodel would put the inbound nodes for concatenate layers in an extra nested array. My call in python looks like:
This would create the following output in the manifest (notice the extra
[
and]
:so thats why i added an extra check in generic_utils.cs for this extra nest. I would love some feedback on the implementation of this check and if it's the correct way to do.
And lastly, since concatenate layers have more than 1 input node we need a List when processing nodes in Functional.FromConfig.cs.
I also added a few tests to make sure that saving and loading a model with concatenate layers is the same (this was not the case before my changes).