You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# state is updated and state2 is a pointer to state
71
71
```
72
72
73
+
When adding a new algorithm, in-place support can be achieved by modifying `TensorTree`s
74
+
via the [`flexi_tree_map`](https://normal-computing.github.io/posteriors/api/tree_utils/#posteriors.tree_utils.flexi_tree_map) function:
75
+
76
+
```python
77
+
from posteriors.tree_utils import flexi_tree_map
78
+
79
+
new_state = flexi_tree_map(lambdax: x +1, state, inplace=True)
80
+
```
81
+
82
+
As `posteriors` transform states are immutable `NamedTuple`s, in-place modification of
83
+
`TensorTree` leaves can be achieved by modifying the data of the tensor directly with [`tree_insert_`](https://normal-computing.github.io/posteriors/api/tree_utils/#posteriors.tree_utils.tree_insert_):
0 commit comments