-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implementation of get_all_variables() for sonnet modules.
We introduce a module call stack, which tracks the order in which modules are called. When a module enters __call__ (or _enter_variable_scope) it adds itself to the top of the stack. Variables created inside of the custom_getter are added to a collection specific to the module on the top of the stack. Before exiting __call__ (or _enter_variable_scope) the module moves all variables added to this graph collection into `_all_variables`, removes itself from the top of the stack, and adds all of the variables from `self._all_variables` to collection for the module that is currently at the top of the module stack. PiperOrigin-RevId: 185664981
- Loading branch information
1 parent
06b8e4f
commit 62f4399
Showing
5 changed files
with
388 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.