TreefyState#

class brainstate.TreefyState(type, value, **metadata)[source]#

The state as a pytree.

copy()[source]#

Copy the state reference.

Return type:

TreefyState[TypeVar(A)]

get_metadata()[source]#

Get the metadata of the state reference

Return type:

Dict[str, Any]

property name: str | None#

The name of the state.

replace(value)[source]#

Replace the value of the state reference.

Return type:

TreefyState[TypeVar(B)]

to_state()[source]#

Convert the state reference to the state.

Return type:

State[TypeVar(A)]