torch.fx.experimental.unification.unification_tools.update_in
- torch.fx.experimental.unification.unification_tools.update_in(d, keys, func, default=None, factory=<class 'dict'>)
Update value in a (potentially) nested dictionary
inputs: d - dictionary on which to operate keys - list or tuple giving the location of the value to be changed in d func - function to operate on that value
If keys == [k0,..,kX] and d[k0]..[kX] == v, update_in returns a copy of the original dictionary with v replaced by func(v), but does not mutate the original dictionary.
If k0 is not a key in d, update_in creates nested dictionaries to the depth specified by the keys, with the innermost value set to func(default).