torch.fx.experimental.unification.unification_tools.valfilter#
- torch.fx.experimental.unification.unification_tools.valfilter(predicate, d, factory=<class 'dict'>)[source]#
Filter items in dictionary by value
>>> iseven = lambda x: x % 2 == 0 >>> d = {1: 2, 2: 3, 3: 4, 4: 5} >>> valfilter(iseven, d) {1: 2, 3: 4}
See also
keyfilter itemfilter valmap
- Return type:
dict[_K, _V]