Spec-Zone.ru › PyTorch 2.14

torch.fx.experimental.unification.unification_tools.itemfilter

torch.fx.experimental.unification.unification_tools.itemfilter(predicate, d, factory=<class 'dict'>) [исходный код]

Фильтрует элементы словаря по элементу

>>> def isvalid(item):
...     k, v = item
...     return k % 2 == 0 and v < 4
>>> d = {1: 2, 2: 3, 3: 4, 4: 5}
>>> itemfilter(isvalid, d)
{2: 3}

См. также

keyfilter valfilter itemmap

Тип возвращаемого значения:

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.itemfilter.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API