torch.fx.experimental.unification.unification_tools.assoc
-
torch.fx.experimental.unification.unification_tools.assoc(d, key, value, factory=<class 'dict'>)[source] -
Возвращает новый словарь с новой парой ключ-значение
В новом словаре для d[key] устанавливается значение value. Исходный словарь не изменяется.
>>> assoc({"x": 1}, "x", 2) {'x': 2} >>> assoc({"x": 1}, "y", 3) {'x': 1, 'y': 3}- Тип возвращаемого значения:
-
dict[_K, _V]
© 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.html