Rate this Page

torch.fx.experimental.unification.unification_tools.dissoc#

torch.fx.experimental.unification.unification_tools.dissoc(d, *keys, **kwargs)[source]#

Return a new dict with the given key(s) removed.

New dict has d[key] deleted for each supplied key. Does not modify the initial dictionary.

>>> dissoc({"x": 1, "y": 2}, "y")
{'x': 1}
>>> dissoc({"x": 1, "y": 2}, "y", "x")
{}
>>> dissoc({"x": 1}, "y")  # Ignores missing keys
{'x': 1}