Skip to content

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