elasticai.creator.ir_transforms.reorder#

Module Contents#

Classes#

Functions#

Data#

API#

elasticai.creator.ir_transforms.reorder.build_sequential_pattern(sequence: collections.abc.Sequence[elasticai.creator.ir.Node]) elasticai.creator.ir.Implementation[elasticai.creator.ir.Node, elasticai.creator.ir.Edge][source]#
elasticai.creator.ir_transforms.reorder.PNode#

‘TypeVar(…)’

elasticai.creator.ir_transforms.reorder.GNode#

‘TypeVar(…)’

elasticai.creator.ir_transforms.reorder.PNodeCon#

‘TypeVar(…)’

elasticai.creator.ir_transforms.reorder.GNodeCon#

‘TypeVar(…)’

class elasticai.creator.ir_transforms.reorder.NodeConstraint[source]#

Bases: typing.Protocol[elasticai.creator.ir_transforms.reorder.PNodeCon, elasticai.creator.ir_transforms.reorder.GNodeCon]

__call__(*, pattern_node: elasticai.creator.ir_transforms.reorder.PNodeCon, graph_node: elasticai.creator.ir_transforms.reorder.GNodeCon) bool[source]#
class elasticai.creator.ir_transforms.reorder.SequenceReorderer(old_order: collections.abc.Sequence[elasticai.creator.ir.Node], new_order: collections.abc.Sequence[elasticai.creator.ir.Node], node_constraint: elasticai.creator.ir_transforms.reorder.NodeConstraint[elasticai.creator.ir.Node, elasticai.creator.ir.Node])[source]#

Initialization

Use this to reorder the first occurence of a pattern as specified by the replacement.

has_changed() bool[source]#

Tells whether the graph has been changed by the last call to reorder.

reorder(impl: elasticai.creator.ir.Implementation) elasticai.creator.ir.Implementation[source]#

Reorder the first occurence of the pattern as specified by the replacement.

The resulting graph and its data are deep copies of the input graph and its data. The new node names are unique but chosen based on the replacement nodes and not based on the original node names. Use has_changed to check whether the graph has been changed by the last call to reorder if you want to keep reordering until you reach a fixed point.

Note

Will create a deep copy even if no changes were made. As such it is always safe to del original_graph after calling reorder.