Skip to content

Fix .submodules attribute on tf.keras.Model in intro_to_modules guide#2415

Open
Sarah-2003 wants to merge 2 commits intotensorflow:masterfrom
Sarah-2003:fix-submodules-attribute-97403
Open

Fix .submodules attribute on tf.keras.Model in intro_to_modules guide#2415
Sarah-2003 wants to merge 2 commits intotensorflow:masterfrom
Sarah-2003:fix-submodules-attribute-97403

Conversation

@Sarah-2003
Copy link

tf.keras.Model in Keras 3 does not have a .submodules attribute. The intro_to_modules guide used my_sequential_model.submodules on a Keras Model instance, which raises AttributeError. Changed to use .layers which is the correct attribute for Keras models.

Also updated the accompanying markdown text from "submodules" to "sub-layers" to match.

Fixes #97403

tf.keras.Model in Keras 3 does not have a .submodules attribute.
The intro_to_modules guide used my_sequential_model.submodules on a
Keras Model instance, which raises AttributeError. Changed to use
.layers which is the correct attribute for Keras models.

Also updated the accompanying markdown text from "submodules" to
"sub-layers" to match.

Fixes #97403
@Sarah-2003 Sarah-2003 requested a review from a team as a code owner March 15, 2026 11:27
@github-actions
Copy link

Preview

Preview and run these notebook edits with Google Colab: Rendered notebook diffs available on ReviewNB.com.

Format and style

Use the TensorFlow docs notebook tools to format for consistent source diffs and lint for style:
$ python3 -m pip install -U --user git+https://github.com/tensorflow/docs

$ python3 -m tensorflow_docs.tools.nbfmt notebook.ipynb
$ python3 -m tensorflow_docs.tools.nblint --arg=repo:tensorflow/docs notebook.ipynb
If commits are added to the pull request, synchronize your local branch: git pull origin fix-submodules-attribute-97403

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant