(x: Union[Tensor, TensorSpec])
| 1162 | prefix = separator.join(path[: idx + 1]) if separator and is_str else path[: idx + 1] |
| 1163 | raise KeyError(f"No entries found at path '{prefix}'") |
| 1164 | x = x[key] |
| 1165 | |
| 1166 | return x |
| 1167 | |
| 1168 | |
| 1169 | def set_recursively( |
| 1170 | x: NestedTensor, |
| 1171 | *, |
| 1172 | value: Tensor, |
| 1173 | path: Union[str, Sequence[str]], |