torch.fx.experimental.unification.unification_tools.assoc_in
-
torch.fx.experimental.unification.unification_tools.assoc_in(d, keys, value, factory=<class 'dict'>)[исходный код] -
Возвращает новый словарь с новой парой «ключ — значение», которая может быть вложенной
>>> purchase = { ... "name": "Alice", ... "order": {"items": ["Apple", "Orange"], "costs": [0.50, 1.25]}, ... "credit card": "5555-1234-1234-1234", ... } >>> assoc_in(purchase, ["order", "costs"], [0.25, 1.00]) {'credit card': '5555-1234-1234-1234', 'name': 'Alice', 'order': {'costs': [0.25, 1.00], 'items': ['Apple', 'Orange']}}- Тип возвращаемого значения:
© 2026, PyTorch Contributors
PyTorch has a BSD-style license, as found in the LICENSE file.
https://docs.pytorch.org/docs/2.14/generated/torch.fx.experimental.unification.unification_tools.assoc_in.html