Skip to content
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

added example docstrings #3453

Merged
merged 1 commit into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions flax/core/frozen_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@ def pop(self, key: K) -> Tuple['FrozenDict[K, V]', V]:

Example::

state, params = variables.pop('params')
>>> from flax.core import FrozenDict
>>> variables = FrozenDict({'params': {...}, 'batch_stats': {...}})
>>> new_variables, params = variables.pop('params')

Args:
key: the key to remove from the dict
Expand Down Expand Up @@ -235,7 +237,9 @@ def copy(

Example::

new_variables = copy(variables, {'additional_entries': 1})
>>> from flax.core import FrozenDict, copy
>>> variables = FrozenDict({'params': {...}, 'batch_stats': {...}})
chiamp marked this conversation as resolved.
Show resolved Hide resolved
>>> new_variables = copy(variables, {'additional_entries': 1})

Args:
x: the dictionary to be copied and updated
Expand All @@ -262,7 +266,9 @@ def pop(

Example::

state, params = pop(variables, 'params')
>>> from flax.core import FrozenDict, pop
>>> variables = FrozenDict({'params': {...}, 'batch_stats': {...}})
>>> new_variables, params = pop(variables, 'params')

Args:
x: the dictionary to remove the entry from
Expand Down
Loading