-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build_from_config()
gets a dictionary with wrong types when loading a keras_v3
model
#43
Comments
@sachinprasadhs, |
Hi @MidnessX , The default build behavior for models, which accepts the To use the TensorShape methods, you can simply create a TensorShape using the |
Hi @nkovela1, thanks for your reply. I imagined the problem had to do with serialization. However, I don't understand why the |
@MidnessX Ah I see the source of confusion here, the docs you referred to are for the Layer class I'm not sure why the method's API reference did not make it onto tensorflow.org under the Model class, sorry about that. I will contact @MarkDaoust from TFDocs for help on this. |
It is documented on https://www.tensorflow.org/api_docs/python/tf/keras/layers/Layer#build_from_config It looks like its set not to show the inherited methods, but I'm not 100% sure where. |
I believe it would be useful to add a https://www.tensorflow.org/api_docs/python/tf/keras/Model
|
It looks like that's configured here: What behavior do we want? |
Yes, I didn't look at the source code, just the docs, so I thought that |
@MidnessX thanks for raising this issue! It really helps us improve the documentation. @MarkDaoust Are the APIs associated with these classes (Layer, Model, etc.) generated from the docstring automatically? Is there a config file that contains those that show up on the website? |
Yes, all the api reference pages on tensorflow.org are generated from the pip package and it's docstrings. It's configurable, but mainly it tries to generate doc pages for everything in the public API. What's visible is mostly controlled by the filters passed to And these |
System information.
Describe the problem.
When loading back a custom
tf.keras.Model
saved in thekeras_v3
format, itsbuild()
method receives argumentinput_shape
having typelist
rather thantf.TensorShape
as stated in the documentation.This is a problem whenever the
build()
method uses attributes of thetf.TensorShape
object, such asrank
, because an exception is raised and the model cannot be loaded.Describe the current behavior.
The following line calls
build_from_config()
on the custom model passing abuild_config
dictionary which contains aninput_shape
key having value of typelist
.Describe the expected behavior.
build_from_config()
receives a dictionary with proper types.Contributing.
Standalone code to reproduce the issue.
Source code / logs.
Workaround
Do not use any of the
tf.TensorShape
attributes and methods, treating its instances aslist
s (e.g. usinglen(input_shape)
instead ofinput_shape.rank
).The text was updated successfully, but these errors were encountered: