beanmachine.ppl.compiler.fix_additions module
- beanmachine.ppl.compiler.fix_additions.addition_fixer(bmg: beanmachine.ppl.compiler.bm_graph_builder.BMGraphBuilder, typer: beanmachine.ppl.compiler.lattice_typer.LatticeTyper) Callable[[beanmachine.ppl.compiler.bmg_nodes.BMGNode], Union[beanmachine.ppl.compiler.bmg_nodes.BMGNode, None, beanmachine.ppl.compiler.fix_problem.NodeFixerError]]
This fixer rewrites additions into complements: * add(1, negate(prob)) or add(negate(prob), 1) -> complement(prob) * add(1, negate(bool)) or add(negate(bool), 1) -> complement(bool)
- beanmachine.ppl.compiler.fix_additions.sum_fixer(bmg: beanmachine.ppl.compiler.bm_graph_builder.BMGraphBuilder, typer: beanmachine.ppl.compiler.lattice_typer.LatticeTyper) Callable[[beanmachine.ppl.compiler.bmg_nodes.BMGNode], Union[beanmachine.ppl.compiler.bmg_nodes.BMGNode, None, beanmachine.ppl.compiler.fix_problem.NodeFixerError]]
This fixer rewrites vector sums into multiary additions.