Skip to content

Fix: use add_weight instead of tf.Variable in training loop guide #2388

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Aaraviitkgp
Copy link

Fixes [tensorflow/tensorflow#97599]
(tensorflow/tensorflow#97599).
Replaced tf.Variable(...) with add_weight(...) in the custom model to avoid training warning and ensure proper Keras weight tracking.
Screenshot 2025-07-26 at 4 07 27 PM

@Aaraviitkgp Aaraviitkgp requested a review from a team as a code owner July 26, 2025 10:37
Copy link

google-cla bot commented Jul 26, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

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-trainable-warning-doc

@Aaraviitkgp
Copy link
Author

@googlebot I signed it!

@MarkDaoust
Copy link
Member

Hi, thanks for creating the PR, but this doesn't work in Colab, please fix.

@Aaraviitkgp Aaraviitkgp reopened this Jul 28, 2025
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-trainable-warning-doc

@Aaraviitkgp
Copy link
Author

Aaraviitkgp commented Jul 28, 2025 via email

@Aaraviitkgp
Copy link
Author

I have made changes please check

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.

2 participants