get_fusion_pattern_to_extra_inputs_getter
-
class torch.ao.quantization.backend_config.utils.get_fusion_pattern_to_extra_inputs_getter(backend_config)[исходный код] -
Получить отображение шаблона слияния в функцию, которая возвращает дополнительные входные узлы из шаблона слияния в порядке, требуемом корневым узлом. Это необязательно: если оно не задано, дополнительные входные данные для корневого узла копироваться не будут.
Пример:
# Let's say we have the pattern (torch.add, MatchAllNode, (torch.nn.BatchNorm2d, torch.nn.Conv2d)) # and root node is torch.nn.Conv2d, and the node in MatchAllNode would be an extra # argument to the fused module, we can unpack the pattern and return the node at # MatchAllNode here # we can implement extra_inputs_getter as follows: def extra_inputs_getter(pattern) -> List[Any]: add, extra_input, conv_pattern = pattern return [extra_input]
© 2026, PyTorch Contributors
PyTorch has a BSD-style license, as found in the LICENSE file.
https://docs.pytorch.org/docs/2.14/generated/torch.ao.quantization.backend_config.utils.get_fusion_pattern_to_extra_inputs_getter.html