Skip to content

Adds support for Call-Context Arguments #843

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 21, 2025
Merged

Conversation

copybara-service[bot]
Copy link

Adds support for Call-Context Arguments

Create an argument propagation flow for call-context arguments.
Currently, keras uses training argument to infer whether layer should be called in training/inference mode. This change introduces a general flow of propagating arguments from a parent call to a child call (using call_context), so that we can add new control flow arguments in the future using a generic framework.

This change does the following things:

  • Adds a call_context_args dictionary in the call_context object to store call-context arguments being propagated.
  • Changes current layer implementation to use the general propagation flow instead of using hardcoded training.
  • Adds utilities to query and set this context arguments in the Layer class.

Create an argument propagation flow for call-context arguments.
Currently, keras uses `training` argument to infer whether layer should be called in training/inference mode. This change introduces a general flow of propagating arguments from a parent call to a child call (using call_context), so that we can add new control flow arguments in the future using a generic framework.

This change does the following things:
* Adds a `call_context_args` dictionary in the call_context object to store call-context arguments being propagated.
* Changes current layer implementation to use the general propagation flow instead of using hardcoded `training`.
* Adds utilities to query and set this context arguments in the `Layer` class.

PiperOrigin-RevId: 761325027
@copybara-service copybara-service bot merged commit 803835f into master May 21, 2025
@copybara-service copybara-service bot deleted the test_754990602 branch May 21, 2025 02:44
@JyotinderSingh JyotinderSingh removed the request for review from hertschuh May 21, 2025 03:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants