Rate this Page

torch.fx.experimental.unification.unification_tools.valmap#

torch.fx.experimental.unification.unification_tools.valmap(func, d, factory=<class 'dict'>)[source]#

Apply function to values of dictionary

>>> bills = {"Alice": [20, 15, 30], "Bob": [10, 35]}
>>> valmap(sum, bills)  
{'Alice': 65, 'Bob': 45}

See also

keymap itemmap