Replaces the selected subtree(s) with a fixed replacement. Args: replacement: The pytree to replace with. Returns: A modified version of the original tree, with this replacement in place of any selected subtrees.
(self, replacement: Any)
| 341 | return new_selection.deselect() |
| 342 | |
| 343 | def set(self, replacement: Any) -> Any: |
| 344 | """Replaces the selected subtree(s) with a fixed replacement. |
| 345 | |
| 346 | Args: |
| 347 | replacement: The pytree to replace with. |
| 348 | |
| 349 | Returns: |
| 350 | A modified version of the original tree, with this replacement in place |
| 351 | of any selected subtrees. |
| 352 | """ |
| 353 | return self.apply(lambda _: replacement) |
| 354 | |
| 355 | def get_by_path(self) -> collections.OrderedDict[KeyPath, SelectedSubtree]: |
| 356 | """Retrieves the selected subtree(s) based on their path(s). |