beanmachine.ppl.compiler.fix_problem module

class beanmachine.ppl.compiler.fix_problem.NodeFixerError

Bases: object

beanmachine.ppl.compiler.fix_problem.ancestors_first_graph_fixer(bmg: beanmachine.ppl.compiler.bm_graph_builder.BMGraphBuilder, typer: beanmachine.ppl.compiler.typer_base.TyperBase, node_fixer: Callable[[beanmachine.ppl.compiler.bmg_nodes.BMGNode], Union[beanmachine.ppl.compiler.bmg_nodes.BMGNode, None, beanmachine.ppl.compiler.fix_problem.NodeFixerError]], get_error: Optional[Callable[[beanmachine.ppl.compiler.bmg_nodes.BMGNode, int], Optional[beanmachine.ppl.compiler.error_report.BMGError]]] = None) Callable[[], Tuple[bool, beanmachine.ppl.compiler.error_report.ErrorReport]]
beanmachine.ppl.compiler.fix_problem.conditional_graph_fixer(condition: bool, fixer: Callable[[], Tuple[bool, beanmachine.ppl.compiler.error_report.ErrorReport]]) Callable[[], Tuple[bool, beanmachine.ppl.compiler.error_report.ErrorReport]]
beanmachine.ppl.compiler.fix_problem.edge_error_pass(bmg: beanmachine.ppl.compiler.bm_graph_builder.BMGraphBuilder, get_error: Callable[[beanmachine.ppl.compiler.bmg_nodes.BMGNode, int], Optional[beanmachine.ppl.compiler.error_report.BMGError]]) Callable[[], Tuple[bool, beanmachine.ppl.compiler.error_report.ErrorReport]]

Given a function that takes an edge in the graph and returns an optional error, build a pass which checks for errors every edge in the graph that is an ancestor of a query, observation, or sample. The edge is given as the descendant node and the index of the parent node.

beanmachine.ppl.compiler.fix_problem.fixpoint_graph_fixer(fixer: Callable[[], Tuple[bool, beanmachine.ppl.compiler.error_report.ErrorReport]]) Callable[[], Tuple[bool, beanmachine.ppl.compiler.error_report.ErrorReport]]

Executes a graph fixer repeatedly until it stops making progress or produces an error.

beanmachine.ppl.compiler.fix_problem.identity_graph_fixer()
beanmachine.ppl.compiler.fix_problem.node_error_pass(bmg: beanmachine.ppl.compiler.bm_graph_builder.BMGraphBuilder, get_error: Callable[[beanmachine.ppl.compiler.bmg_nodes.BMGNode], Optional[beanmachine.ppl.compiler.error_report.BMGError]]) Callable[[], Tuple[bool, beanmachine.ppl.compiler.error_report.ErrorReport]]

Given a function that takes an node in the graph and returns an optional error, build a pass which checks for errors every node in the graph that is an ancestor of a query, observation, or sample.

beanmachine.ppl.compiler.fix_problem.node_fixer_first_match(fixers: List[Callable[[beanmachine.ppl.compiler.bmg_nodes.BMGNode], Union[beanmachine.ppl.compiler.bmg_nodes.BMGNode, None, beanmachine.ppl.compiler.fix_problem.NodeFixerError]]]) Callable[[beanmachine.ppl.compiler.bmg_nodes.BMGNode], Union[beanmachine.ppl.compiler.bmg_nodes.BMGNode, None, beanmachine.ppl.compiler.fix_problem.NodeFixerError]]
beanmachine.ppl.compiler.fix_problem.sequential_graph_fixer(fixers: List[Callable[[], Tuple[bool, beanmachine.ppl.compiler.error_report.ErrorReport]]]) Callable[[], Tuple[bool, beanmachine.ppl.compiler.error_report.ErrorReport]]

Takes a list of graph fixers and applies each in turn once unless one fails.

beanmachine.ppl.compiler.fix_problem.type_guard(t: Type, fixer: Callable) Callable[[beanmachine.ppl.compiler.bmg_nodes.BMGNode], Union[beanmachine.ppl.compiler.bmg_nodes.BMGNode, None, beanmachine.ppl.compiler.fix_problem.NodeFixerError]]