Skip to content

Add no_automatic_dependency_tracking utility. #82

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

Merged
merged 1 commit into from
May 15, 2025

Conversation

hertschuh
Copy link
Collaborator

This wraps the private equivalent decorators in Keras and TensorFlow.

This wraps the private equivalent decorators in Keras and TensorFlow.
@hertschuh hertschuh requested a review from abheesht17 May 12, 2025 19:06
Comment on lines +19 to +22
if keras.backend.backend() == "tensorflow":
import tensorflow as tf

fn = tf.__internal__.tracking.no_automatic_dependency_tracking(fn)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick question, mainly for my understanding: why do we not disable this in core Keras itself?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is a good question. Apparently, we didn't need it.

Normally, this is about not tracking Layers, Metrics and Variables. The reason I need it is not because of that, it's because dicts, lists, etc. get wrapped into TrackedDict, TrackedList etc. and the Tensorflow equivalents. I need configuration structures that are nested, but then, when I pass the nested configs to some APIs, that API complains about TrackedDict, TrackedList, etc. All I want is to preserve the original structures.

@abheesht17 abheesht17 merged commit ec6724e into keras-team:main May 15, 2025
5 checks passed
@hertschuh hertschuh deleted the dependency_tracking branch May 15, 2025 01:09
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