Replaces the selected subtree(s) in order. Args: replacements: An iterable of PyTrees to insert at the selected locations, in order. Returns: A modified version of the original tree, with replacements taken from the iterable.
(self, replacements: Iterable[Any])
| 417 | return tuple(self.selected_by_path.values()) |
| 418 | |
| 419 | def set_sequence(self, replacements: Iterable[Any]) -> Any: |
| 420 | """Replaces the selected subtree(s) in order. |
| 421 | |
| 422 | Args: |
| 423 | replacements: An iterable of PyTrees to insert at the selected locations, |
| 424 | in order. |
| 425 | |
| 426 | Returns: |
| 427 | A modified version of the original tree, with replacements taken from the |
| 428 | iterable. |
| 429 | """ |
| 430 | replacer = {} |
| 431 | for keypath, replacement in zip(self.selected_by_path.keys(), replacements): |
| 432 | replacer[keypath] = replacement |
| 433 | return self.set_by_path(replacer) |
| 434 | |
| 435 | def flatten_selected_selections( |
| 436 | self: "Selection[Selection[SelectedSubtree]]", |