beanmachine.ppl.compiler.fix_multiary_ops module
- class beanmachine.ppl.compiler.fix_multiary_ops.MultiaryOperatorFixer(bmg: beanmachine.ppl.compiler.bm_graph_builder.BMGraphBuilder, operator: type)
Bases:
object
This fixer transforms graphs with long chains of binary operator nodes into multiary operations. This greatly decreases both the number of nodes and the number of edges in the graph, which can lead to performance wins during inference.
- accumulate_input_nodes(n: beanmachine.ppl.compiler.bmg_nodes.BMGNode) List[beanmachine.ppl.compiler.bmg_nodes.BMGNode]
- beanmachine.ppl.compiler.fix_multiary_ops.multiary_addition_fixer(bmg: beanmachine.ppl.compiler.bm_graph_builder.BMGraphBuilder) Callable[[beanmachine.ppl.compiler.bmg_nodes.BMGNode], Union[beanmachine.ppl.compiler.bmg_nodes.BMGNode, None, beanmachine.ppl.compiler.fix_problem.NodeFixerError]]
This fixer transforms graphs with long chains of binary addition nodes into multiary addition. This greatly decreases both the number of nodes and the number of edges in the graph, which can lead to performance wins during inference.
- beanmachine.ppl.compiler.fix_multiary_ops.multiary_multiplication_fixer(bmg: beanmachine.ppl.compiler.bm_graph_builder.BMGraphBuilder) Callable[[beanmachine.ppl.compiler.bmg_nodes.BMGNode], Union[beanmachine.ppl.compiler.bmg_nodes.BMGNode, None, beanmachine.ppl.compiler.fix_problem.NodeFixerError]]
This fixer transforms graphs with long chains of binary multiplication nodes into multiary multiplication. This greatly decreases both the number of nodes and the number of edges in the graph, which can lead to performance wins during inference.