torch.fx.experimental.unification.unification_tools.keyfilter
-
torch.fx.experimental.unification.unification_tools.keyfilter(predicate, d, factory=<class 'dict'>)[source] -
Фильтрует элементы словаря по ключу
>>> iseven = lambda x: x % 2 == 0 >>> d = {1: 2, 2: 3, 3: 4, 4: 5} >>> keyfilter(iseven, d) {2: 3, 4: 5}См. также
valfilter itemfilter keymap
- Тип возвращаемого значения:
-
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.keyfilter.html